opencv3_java 图像的侵蚀Erode erode

图像的侵蚀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);
		}

	}

}




你可能感兴趣的:(java,opencv3)