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

region_of_interest() fillpoly #107

Closed
Abhishek-EE opened this issue Jun 10, 2021 · 1 comment
Closed

region_of_interest() fillpoly #107

Abhishek-EE opened this issue Jun 10, 2021 · 1 comment

Comments

@Abhishek-EE
Copy link

Hello,

So while I was trying to work through this assignment I came across a weird issue, when I am trying to run the region_of_interest() function it is giving me an error message that is

error Traceback (most recent call last)
in
7
8 vertices = np.array([[0,0],[300,450],[530,230]],dtype=np.int32)
----> 9 img = region_of_interest(img,vertices)
10 img = gaussian_blur(img,3)
11

in region_of_interest(img, vertices)
39 #filling pixels inside the polygon defined by "vertices" with the fill color
40
---> 41 cv2.fillPoly(mask, vertices, ignore_mask_color)
42
43 #returning the image only where mask pixels are nonzero

error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\drawing.cpp:2403: error: (-215:Assertion failed) p.checkVector(2, CV_32S) >= 0 in function 'cv::fillPoly'

Initially I thought the issue is because of the datatype and not using correct datatype but as you can see that even after using the numpy int32 the issue still remains.

@Abhishek-EE
Copy link
Author

Ok I figured it out, it was my mistake, the input vertices array to the fillpoly function is a 3-Dimension array and not 2-D array which I was using so by adding an extra bracket to the np.array function solves the probelm

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