I am trying to run polygonpoint test function for a polygon. My code looks something like below, does it only meant for coutours ?
import ast
import cv2
import numpy as np
point1 = (25, 50)
t = "201.94,191.31;158.20,343.59;520.55,361.55;469.79,175.70" # closed polygon
pts = [*map(ast.literal_eval, t.split(';'))]
pts = np.array(pts)
cv2.pointPolygonTest(pts, point1, False)
I am getting below error
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-454-bfdc7e835e9b> in <module>
----> 1 cv2.pointPolygonTest(pts, point1, False)
error: OpenCV(4.3.0) /io/opencv/modules/imgproc/src/geometry.cpp:103: error: (-215:Assertion failed) total >= 0 && (depth == CV_32S || depth == CV_32F) in function 'pointPolygonTest'