Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.