opencv3_java 图像的侵蚀Erode erode

时间:2023-02-03 19:59:52

图像的侵蚀Erode erode


package opencv_java_demo;

import org.opencv.core.*;
import org.opencv.imgcodecs.*;
import org.opencv.imgproc.Imgproc;

public class Erode {

public static void main(String[] args) {
try{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

Mat src=Imgcodecs.imread("./images/lenna.jpg");
//读取图像到矩阵中
if(src.empty()){
throw new Exception("no file");
}

Mat dst = new Mat();
//复制矩阵进入dst

Imgproc.erode(src,dst,new Mat());
Imgcodecs.imwrite("./images/Erode.jpg", dst);
}catch(Exception e){
System.out.println("例外:" + e);
}

}

}



opencv3_java 图像的侵蚀Erode erode