Sub Rectangle or ROI problem in opencv
Posted
by iva123
on Stack Overflow
See other posts from Stack Overflow
or by iva123
Published on 2010-05-06T08:24:36Z
Indexed on
2010/05/06
8:28 UTC
Read the original article
Hit count: 757
Hi,
I'm trying to convert this c code(http://nashruddin.com/OpenCV_Eye_Detection) to the python code, but in c style, he used cvROI thing, since ROI functions are not supported by python-opencv, I tried cvGetSubRect
so Here is the eye detection part of the code :
eye_region = cvGetSubRect(image,cvRect(face.x,int(face.y + (face.height/4)),face.width,int(face.height/2))) eyes = cvHaarDetectObjects(eye_region,eyeCascade,memo,1.15,3,0,cvSize(25,15)) for e in eyes: cvRectangle(image, cvPoint( int(e.x), int(e.y)), cvPoint(int(e.x + e.width), int(e.y + e.height)), CV_RGB(0, 255, 0), 1, 8, 0)
return image;
When I run this code, It draws rectangles irrelevant places. I thought, eye_region coordinates are wrong, and tried some coordinates, but it didn't work. Any idea ?
Note :Face detection method works very well, and it's code is same with the eye detection method.
© Stack Overflow or respective owner