You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am learning Rust and tried to use find_contours_with_threshold function that I have asked ChatGPT to prepare.
Calling: let contours = find_contours_with_threshold::<u8>(&binary_edges, 0u8);
Image dimensions were too big for u8. And since I am new to Rust I have been trying to find the cause of this error. I have finally managed to find it, here:
After changing that dimension to u32, it worked.
This cast panics if image width or height is bigger than max of u8. Would it be OK to update this code like this:
contour_points.push(Point::new( cast(pos3.x).expect("Generic data type should be bigger than width."), cast(pos3.y).expect("Generic data type should be bigger than height."), ));
If this is acceptable, I can send a PR.
The text was updated successfully, but these errors were encountered:
sakird
changed the title
Detailen error for generic type parameter of find_contours_with_threshold
Detailed error for generic type parameter of find_contours_with_threshold
Nov 21, 2024
That seems like an improvement to me, since this is a user facing error then having an error message is better than nothing. Thought I might make the error message : Generic Type Parameter T should be bigger than width/Generic Type Parameter T should be bigger than height.
I am learning Rust and tried to use find_contours_with_threshold function that I have asked ChatGPT to prepare.
Calling:
let contours = find_contours_with_threshold::<u8>(&binary_edges, 0u8);
Image dimensions were too big for u8. And since I am new to Rust I have been trying to find the cause of this error. I have finally managed to find it, here:
contour_points.push(Point::new(cast(pos3.x).unwrap(), cast(pos3.y).unwrap()));
After changing that dimension to u32, it worked.
This cast panics if image width or height is bigger than max of u8. Would it be OK to update this code like this:
contour_points.push(Point::new( cast(pos3.x).expect("Generic data type should be bigger than width."), cast(pos3.y).expect("Generic data type should be bigger than height."), ));
If this is acceptable, I can send a PR.
The text was updated successfully, but these errors were encountered: