getting assertion failed error

asked 2019-04-03 10:18:11 -0500

updated 2019-04-03 10:44:37 -0500

LBerger gravatar image

i was trying to make simple paint application with open cv but i am getting this errror .

before this i was making other project on alphabet recognition i was getting same error there also please help sir doing final year project,B.Tech(cs)

File "C:/Users/Deepak/PycharmProjects/Alphabet_Recognition_Gestures-master/Alphabet_Recognition_Gestures-master/", line 82, in <module>
    cnt = sorted(cnts, key = cv2.contourArea, reverse = True)[0]
cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\imgproc\src\shapedescr.cpp:272: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea'

[ WARN:1] terminating async callback

edit retag flag offensive close merge delete


cv::contourArea Did you use numpy array of type np.float32 or np.int32?

LBerger gravatar imageLBerger ( 2019-04-03 10:45:44 -0500 )edit

Actually i aam new to python programming i thinik its int

kamal karki gravatar imagekamal karki ( 2019-04-04 10:37:27 -0500 )edit

See the answers from sorted

supra56 gravatar imagesupra56 ( 2019-04-05 09:15:26 -0500 )edit