Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to detect biggest face in Java

Hi,

I have a question to ask, how do I find the biggest face in an image? When I did this program in C + + code was as follows:

cascade.detectMultiScale (Img, objects, 1.1f, 4, CASCADE_FIND_BIGGEST_OBJECT, Size (20, 20));

Where, exactly, I used the tag: CASCADE_FIND_BIGGEST_OBJECT

to identify the largest face.

But in Java as I do? In the documentation http://docs.opencv.org/java/org/opencv/objdetect/CascadeClassifier.html#detectMultiScale(org.opencv.core.Mat, org.opencv.core.MatOfRect, double, int, int, org.opencv.core.Size, org.opencv.core.Size)

I read this:

flags - Parameters with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

So how do I?

Thank you.

How to detect biggest face in Java

Hi,

I have a question to ask, how do I find the biggest face in an image? When I did this program in C + + code was as follows:

cascade.detectMultiScale (Img, objects, 1.1f, 4, CASCADE_FIND_BIGGEST_OBJECT, Size (20, 20));

Where, exactly, I used the tag: CASCADE_FIND_BIGGEST_OBJECT

to identify the largest face.

But in Java as I do? In the documentation http://docs.opencv.org/java/org/opencv/objdetect/CascadeClassifier.html#detectMultiScale(org.opencv.core.Mat, org.opencv.core.MatOfRect, double, int, int, org.opencv.core.Size, org.opencv.core.Size)

I read this:

flags - Parameters with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

So how do I?

Thank you.

click to hide/show revision 3
retagged

updated 2014-06-26 01:11:58 -0600

berak gravatar image

How to detect biggest face in Java

Hi,

I have a question to ask, how do I find the biggest face in an image? When I did this program in C + + code was as follows:

cascade.detectMultiScale (Img, objects, 1.1f, 4, CASCADE_FIND_BIGGEST_OBJECT, Size (20, 20));

Where, exactly, I used the tag: CASCADE_FIND_BIGGEST_OBJECT

to identify the largest face.

But in Java as I do? In the documentation http://docs.opencv.org/java/org/opencv/objdetect/CascadeClassifier.html#detectMultiScale(org.opencv.core.Mat, org.opencv.core.MatOfRect, double, int, int, org.opencv.core.Size, org.opencv.core.Size)

I read this:

flags - Parameters with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

So how do I?

Thank you.

How to detect biggest face in Java

Hi,

I have a question to ask, how do I find the biggest face in an image? When I did this program in C + + code was as follows:

cascade.detectMultiScale (Img, objects, 1.1f, 4, CASCADE_FIND_BIGGEST_OBJECT, Size (20, 20));

Where, exactly, I used the tag: CASCADE_FIND_BIGGEST_OBJECT

to identify the largest face.

But in Java as I do? In the documentation http://docs.opencv.org/java/org/opencv/objdetect/CascadeClassifier.html#detectMultiScale(org.opencv.core.Mat, org.opencv.core.MatOfRect, double, int, int, org.opencv.core.Size, org.opencv.core.Size)

I read this:

flags - Parameters with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

So how do I?

Thank you.

[Edit.]

Solved:

I solved it this way:

MatOfRect faceDetections MatOfRect = new (); 
faceDetector.detectMultiScale (image, faceDetections);
Rect biggestFace=new Rect(); 
for (Rect rect: faceDetections.toArray ()) 
{ 
if (rect.area ()> biggestFace.area ()) 
{ 
biggestFace = rect; 
} 
}

How to detect biggest face in Java

Hi,

I have a question to ask, how do I find the biggest face in an image? When I did this program in C + + code was as follows:

cascade.detectMultiScale (Img, objects, 1.1f, 4, CASCADE_FIND_BIGGEST_OBJECT, Size (20, 20));

Where, exactly, I used the tag: CASCADE_FIND_BIGGEST_OBJECT

to identify the largest face.

But in Java as I do? In the documentation http://docs.opencv.org/java/org/opencv/objdetect/CascadeClassifier.html#detectMultiScale(org.opencv.core.Mat, org.opencv.core.MatOfRect, double, int, int, org.opencv.core.Size, org.opencv.core.Size)

I read this:

flags - Parameters with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

So how do I?

Thank you.

[Edit.]

Solved:

I solved it this way:

MatOfRect faceDetections MatOfRect = new (); MatOfRect(); 
faceDetector.detectMultiScale (image, faceDetections);
Rect biggestFace=new Rect(); 
for (Rect rect: faceDetections.toArray ()) 
{ 
if (rect.area ()> biggestFace.area ()) 
{ 
biggestFace = rect; 
} 
}