Ask Your Question

How to Blur a Rect[] with OpenCV Java

asked 2016-06-15 18:59:46 -0500

xLEZZO gravatar image

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-15 20:05:17 -0500

Tetragramm gravatar image

In java you use the .submat(Rect) method. Make sure to familiarize yourself with the basic functions of the Mat class. It's very important.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-06-15 18:59:46 -0500

Seen: 686 times

Last updated: Jun 15 '16