Error compiling: detect_and_draw in opencv python
I am currently working on eyes and mouth detection using opencv and python. From the compile output, there are multiple mouth detection whereby i need single mouth detection. However when i compile, i get the error below:
in detect_and_draw mouth = mouth_cascade.detectMultiScale(gray, scaleFactor = 1.5, minNeighbors = 2, minSize = (15,15)) error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\core\src\array.cpp:2494: error: (-206) Unrecognized or unsupported array type in function cvGetMat.
your image is probably invalid.
can you show a bit more code ? where does "gray" come from ?
it is a real time camera capture..
hi @berak, here is where i defined the detect_and_draw:
def detect_and_draw(img, gray): faces = face_cascade.detectMultiScale(gray, scaleFactor = 1.3, minNeighbors = 3, minSize = (30,30)) for (x,y,w,h) in faces: img = cv2.rectangle(img, (x,y),(x+w,y+h),(255,0,0),2) gray = gray[y:y+h, x:x+w] color = img[y:y+h, x:x+w]
please rather edit your question, and format code properly (10101 button)
also, we still can't see, where "gray" comes from, and there's an unexplained "img", too.
please add extensive checks for all your images.