Opencv3_Java 消除图像上的目标EliminateObject photoPhoto

消除图像上的目标EliminateObject photoPhoto


package opencv_java_demo;

import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.photo.Photo;

public class EliminateObject {

	public static void main(String[] args) {
		try{
			Mat src=Imgcodecs.imread("./images/lenna.jpg");
			Mat msk=Imgcodecs.imread("./images/lenna_mask.jpg");
			
			if(src.empty()||msk.empty()){
				throw new Exception("no file");
			}
			
			Mat dst=src.clone();
			Photo.inpaint(src, msk, dst, 1, Photo.INPAINT_TELEA);
			
			Imgcodecs.imwrite("./imgaes/lenna_mask_dst.jpg", dst);
		}catch(Exception e){
			System.out.println("例外"+e);
		}

	}

}


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