Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

localize the eyes using ROI

$
0
0
I have used face-cascade classifier and found the face and found eyes region using ROI without using eye cascade as shown in the image ![Image](/upfiles/14482121066951227.png). Now I want to apply ROI to detect eyes region exactly from given face coordinates how can I get this result ? ![image description](/upfiles/14482122175232974.png) This is my code for the first image : cvtColor(frame, frame_gray, COLOR_BGR2GRAY); equalizeHist(frame_gray, frame_gray); // Detect faces face_cascade.detectMultiScale(frame_gray, faces, 1.1, 4, CASCADE_SCALE_IMAGE, Size(20, 20)); // Set Region of Interest size_t i = 0; for (i = 0; i < faces.size(); i++) // Iterate through all current elements (detected faces) { Point pt1(faces[i].x, faces[i].y); // Display detected faces on main window - live stream from camera Point pt2((faces[i].x + faces[i].height), (faces[i].y + faces[i].width)); rectangle(frame, pt1, pt2, Scalar(0, 255, 0), 2, 8, 0); // set ROI for the eyes Rect Roi = faces[i]; Roi.height = Roi.height / 4; Roi.y = Roi.y + Roi.height; Mat eye_region = frame(Roi).clone(); Mat eye_gray = frame(Roi).clone(); imshow("video main frame", eye_region);

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>