opencv3_java 矩阵和图像的函数之加和阿尔法融合 add

矩阵和图像的函数之加和阿尔法融合 add


package opencv_java_demo;

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

public class Add {

	public static void main(String[] args) {
		try{
			System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
			
			Mat src1=Imgcodecs.imread("./images/lenna.jpg");
			Mat src2=Imgcodecs.imread("./images/Sobel.jpg");
			//读取图像到矩阵中
			if(src1.empty()||src2.empty()){
				throw new Exception("no file");
			}
			
			Mat dst = new Mat();
			
			Core.add(src1, src2, dst);
			
			Imgcodecs.imwrite("./images/Add.jpg", dst);
		}catch(Exception e){
			System.out.println("例外:" + e);
		}

	}

}






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