Error compiling: detect_and_draw in opencv python

asked 2016-04-05 03:03:23 -0600

KJR gravatar image

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.

edit retag flag offensive close merge delete



your image is probably invalid.

can you show a bit more code ? where does "gray" come from ?

berak gravatar imageberak ( 2016-04-05 03:13:53 -0600 )edit

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]

KJR gravatar imageKJR ( 2016-04-05 03:31:26 -0600 )edit

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.

berak gravatar imageberak ( 2016-04-05 03:44:09 -0600 )edit