Ask Your Question

Revision history [back]

You could use ROI(region of interest) to operate specific portion(rectangular) of Mat,

Assume you already detected face, and got face rect.

     Mat frame; // input frame
     Rect faceRect; //  face rectangle
     .....................
    //face detection
     .....................

     Now apply ROI
     Mat ROI=frame(faceRect); // here you got Mat with face portion, note that any change made on ROI will change the original Mat, that is frame, as it's not a deep copy operation and that's what you required.

    // blur ROI or any do any  other operation
    .............................................