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
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
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: