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

Measure White Pixels in an image

$
0
0
I have extracted eyes from face using Haar Cascade. Now I want to measure the number of white pixels in the extracted eye image. Please Help . . . . int main() { CascadeClassifier face, eye; if(!face.load("C:\\HAAR\\haarcascade_frontalcatface.xml")){ printf("Error Loading Face Cascade"); return -1; } if(!eye.load("C:\\HAAR\\haarcascade_eye_tree_eyeglasses.xml")){ printf("Error Loading Eye Cascade"); return -1; } VideoCapture capture(0); if(!capture.isOpened()) { printf("Error opening Video Stream"); return -1; } Mat capimg,greyimg; vector faces,eyes; while(1) { capture>>capimg; waitKey(10); cvtColor(capimg, greyimg, CV_BGR2GRAY); cv::equalizeHist(greyimg,greyimg); face.detectMultiScale(greyimg, faces, 1.1, 10, CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING, cvSize(0,0), cvSize(300,300)); for(int i=0; i < faces.size(); i++) { Point pt1(faces[i].x+faces[i].width,faces[i].y+faces[i].height); Point pt2(faces[i].x,faces[i].y); Mat faceroi=greyimg(faces[i]); eye.detectMultiScale(faceroi, eyes,1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30,30)); for(size_t j=0; j

Viewing all articles
Browse latest Browse all 41027

Trending Articles