Ask Your Question

xLEZZO's profile - activity

2016-06-16 14:03:03 -0600 received badge  Editor (source)
2016-06-16 14:01:02 -0600 asked a question Java - detecting ROI, creating submat and copy to original mat

I'm trying to blur the faces of all people detected by the webcam. The problem is that when the webcam detect a face the program shows the crop mat with the blur face.

I tried to put the blur face into the original mat but it doesn't work.

Imgproc.cvtColor(frame, grayFrame, Imgproc.COLOR_BGR2GRAY);
Imgproc.equalizeHist(grayFrame, grayFrame);
if(this.absoluteFaceSize == 0){
    int height = grayFrame.rows();
    if(Math.round(height * 0.2f) > 0){
        this.absoluteFaceSize = Math.round(height * 0.2f);
    }
}
this.faceCascade.detectMultiScale(grayFrame, faces,1.1,2,0 | Objdetect.CASCADE_SCALE_IMAGE,
new Size(this.absoluteFaceSize, this.absoluteFaceSize), new Size());

for(Rect rect : faces.toArray()){
    Imgproc.rectangle(frame, rect.tl(), rect.br(), new Scalar(0,0,255),3);
    Rect rectCrop = new Rect(rect.x, rect.y , rect.width, rect.height);
    Mat imageROI = new Mat(grayFrame,rectCrop);

    //frame is the original mat with the correct size
    Imgproc.GaussianBlur(imageROI, frame, new Size(55, 55), 55);
}

No face detecting image description

with face detecting image description Thanks for your help

2016-06-16 13:55:28 -0600 received badge  Supporter (source)
2016-06-15 20:01:29 -0600 asked a question How to Blur a Rect[] with OpenCV Java

i'm trying to blur the faces detected by the webcam. This is the code to draw the rectangle.

this.faceCascade.detectMultiScale(grayFrame, faces,1.1,2,0 | Objdetect.CASCADE_SCALE_IMAGE,new Size(this.absoluteFaceSize, this.absoluteFaceSize), new Size());

Rect[] facesArray = faces.toArray(); 
for(int i =0; i<facesArray.length; i++){  
          Imgproc.rectangle(frame, facesArray[i].tl(), facesArray[i].br(), new Scalar(0,0,255),3);     }

This is the code to draw the rectangle. i tried to use this to blur

Imgproc.GaussianBlur(source, destination, new Size(55, 55), 55);

In the field source i put frame ,but in the destination field i don't know how to put the rectangle region. i tried to cast facesArray into a Mat but it doesn't work. Thanks for any help.