Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java OpenCV-检测ROI,创建submat并复制到原始mat_Java_Opencv_Blur_Mat - Fatal编程技术网

Java OpenCV-检测ROI,创建submat并复制到原始mat

Java OpenCV-检测ROI,创建submat并复制到原始mat,java,opencv,blur,mat,Java,Opencv,Blur,Mat,我正试图模糊网络摄像头检测到的所有人的脸。 问题是,当网络摄像头检测到人脸时,程序会显示带有模糊人脸的裁剪垫 我试着把模糊的脸放在原来的垫子上,但是没有用 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.

我正试图模糊网络摄像头检测到的所有人的脸。 问题是,当网络摄像头检测到人脸时,程序会显示带有模糊人脸的裁剪垫

我试着把模糊的脸放在原来的垫子上,但是没有用

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 = grayFrame.submat(rectCrop);

    //frame is the original mat with the correct size
    Imgproc.GaussianBlur(imageROI, frame, new Size(55, 55), 55);
}
无人脸检测:

使用人脸检测:


使用此Mat构造函数

Mat imageROI = new Mat(grayFrame,rectCrop);
而不是

 Mat imageROI = grayFrame.submat(rectCrop);

构造函数提供对grayFrame拥有的数据矩阵的引用。因此,对submat的任何修改都会影响bigmat。
submat
提供裁剪矩形的grayFrame数据矩阵的副本。因此,对submat的修改不会影响bigmat

使用Mat的这个构造函数

Mat imageROI = new Mat(grayFrame,rectCrop);
而不是

 Mat imageROI = grayFrame.submat(rectCrop);
构造函数提供对grayFrame拥有的数据矩阵的引用。因此,对submat的任何修改都会影响bigmat。
submat
提供裁剪矩形的grayFrame数据矩阵的副本。因此,对submat的修改不会影响bigmat