Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple issues on latest version of OpenCV #5

Open
pyrusspangj opened this issue Jul 14, 2023 · 0 comments
Open

Multiple issues on latest version of OpenCV #5

pyrusspangj opened this issue Jul 14, 2023 · 0 comments

Comments

@pyrusspangj
Copy link

Firstly I'd like to say, fascinating work by the looks of everything. I've been attempting to manipulate the code to work but it's not quite working.

Error 1: If running the code raw without any edits, the first error will appear on line 165: low = np.min(np.max(cnt, axis=1), axis=0), it will raise a NumPy AxisError; that axis 1 is out of bounds for array of dimension 0.
--> Changing the if statement right above it from "if len(contours) > 0:" to "if contours.ndim > 1:" will then create error 2.
Error 2: This error will occur on line 107 (line may vary depending on how much you modified the code at this point): contours = np.delete(contours, badBlob), it will raise a Value Error, indicating that "The requested array has an inhomogeneous shape after 1 dimensions".
--> Changing the deletion statement to contours = [contour for i, contour in enumerate(contours) if i not in badBlob] will then raise error 3.
Error 3: This error will occur during the program's first contour encounter, and will argue that the "isUpdated" boolean is not defined.
--> Simple fix, just write "isUpdated = False" on the line before the while loop.

Doing all of these adjustments will make the code run without error interruption, but will also fail to do its original job. As I saw from your example photos, I do not doubt at all the ability of the code to work properly, I would just like to know where you believe I went wrong in error handling and fixing.
Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant