opencv3_java 图形图像的均衡Equalize equalizeHist

图形图像的均衡Equalize equalizeHist


package opencv_java_demo;

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

public class Equalize {

	public static void main(String[] args) {
		try{
			System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
			
			Mat src=Imgcodecs.imread("./images/lenna.jpg",Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
			//读取图像到矩阵中,取灰度图像
			if(src.empty()){
				throw new Exception("no file");
			}
			
			Imgcodecs.imwrite("./images/in.jpg", src);
			//输出灰度图像值
			Mat dst=new Mat();
			//定义新矩阵
			Imgproc.equalizeHist(src, dst);
			//辉度平滑
			Imgcodecs.imwrite("./images/equalize.jpg", dst);
			
		}catch(Exception e){
			System.out.println("例外:" + e);
		}

	}

}






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