opencv3_java 图像的Scalar标量合成 AddScalar

图像的Scalar标量合成 AddScalar


package opencv_java_demo;

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

public class AddScalar {

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

	}

}





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