Open sudhasubramaniam opened 6 years ago
Same issue.Have you got any solution for this?
Same Issue, someone please respond.
min_YCrCb = numpy.array([0,133,77],numpy.uint8) max_YCrCb = numpy.array([255,173,127],numpy.uint8) sourceImage = cv2.imread('abc.png') imageYCrCb = cv2.cvtColor(sourceImage,cv2.COLOR_BGR2YCR_CB) skinRegion = cv2.inRange(imageYCrCb,min_YCrCb,max_YCrCb) contours, hierarchy, _ = cv2.findContours(skinRegion, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) for i, c in enumerate(contours): print (i) print (c) print (cv2.contourArea(c))
`
error: OpenCV(3.4.1) /io/opencv/modules/imgproc/src/shapedescr.cpp:272: error: (-215) npoints >= 0 && (depth == 5 || depth == 4) in function contourArea
This is my code import cv2 import numpy as np img = cv2.imread('index.jpeg',0) ret,thresh = cv2.threshold(img,127,255,0) _,contours,hierarchy= cv2.findContours(thresh, 1, 2)
cnt = contour[0] M = cv2.moments(cnt) print(M) area = cv2.contourArea(cnt) perimeter = cv2.arcLength(cnt,True)
I'm getting this error. some one pls help me resolving it. error: /tmp/build/80754af9/opencv_1512491964794/work/modules/imgproc/src/shapedescr.cpp:319: error: (-215) npoints >= 0 && (depth == 5 || depth == 4) in function contourArea