init - 初始化项目

This commit is contained in:
Lee Nony
2022-05-06 01:58:53 +08:00
commit 90a5cc7cb6
6772 changed files with 2837787 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
class EqualizeHist {
public void run(String[] args) {
//! [Load image]
String filename = args.length > 0 ? args[0] : "../data/lena.jpg";
Mat src = Imgcodecs.imread(filename);
if (src.empty()) {
System.err.println("Cannot read image: " + filename);
System.exit(0);
}
//! [Load image]
//! [Convert to grayscale]
Imgproc.cvtColor(src, src, Imgproc.COLOR_BGR2GRAY);
//! [Convert to grayscale]
//! [Apply Histogram Equalization]
Mat dst = new Mat();
Imgproc.equalizeHist( src, dst );
//! [Apply Histogram Equalization]
//! [Display results]
HighGui.imshow( "Source image", src );
HighGui.imshow( "Equalized Image", dst );
//! [Display results]
//! [Wait until user exits the program]
HighGui.waitKey(0);
//! [Wait until user exits the program]
System.exit(0);
}
}
public class EqualizeHistDemo {
public static void main(String[] args) {
// Load the native OpenCV library
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new EqualizeHist().run(args);
}
}