I am very new to opencv and i have a problem:
#Find contours of the filtered frame
contours, hierarchy, _= cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
#Draw Contours
#cv2.drawContours(frame, cnt, -1, (122,122,0), 3)
#cv2.imshow('Dilation',median)
#Find Max contour area (Assume that hand is in the frame)
max_area=100
ci=0
for i in range(len(contours)):
cnt=contours[i]
area = cv2.contourArea(cnt)
if(area>max_area):
max_area=area
ci=i
i found this on the internet, some hand tracking thing but i get this exception:
File "C:\Users\123\Desktop\cv\track.py", line 87,
in<module>
area = cv2.contourArea(cnt)
error: C:\projects\opencv-
python\opencv\modules\imgproc\src\shapedescr.cpp:320: error: (-215) npoints
>= 0 && (depth == CV_32F || depth == CV_32S) in function cv::contourArea
Could you tell me why this is happening and what's the solution? I am using Python 2.7.13 and OpenCV version 3.3.0. Full code here: pastebin