Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

pointPolygonTest() throws error for some reason

$
0
0
I am using the following piece of code to check if a point is inside the contour or not: # form the contour from points cnt = [] for pose in component.part_outline.outline_poses.poses: point = (pose.position.x, pose.position.y) cnt.append(point) cnt = np.array(cnt) # get the point to be tested point = (screw.pose.position.x, screw.pose.position.y) # run the test is_inside = cv2.pointPolygonTest(cnt,point, False) if is_inside > 0: print("bla bla") # act upon the outcome and I get the following error for some reason: "error: OpenCV(3.4.4) /io/opencv/modules/imgproc/src/geometry.cpp:103: error: (-215:Assertion failed) total >= 0 && (depth == CV_32S || depth == CV_32F) in function 'pointPolygonTest'\n\n" This error message does not tell much to be honest, and I have absolutely no idea why this is happening. I checked the image, it's there. The contour and the point are also there, nothing is null or whatsoever. P.S: In case if it helps, I tried to print the variable `is_inside` and it prints (-1.0) for 4 times, then the error is thrown. Any idea?

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>