package
ocv;
import
org.opencv.core.Core;
import
org.opencv.core.Mat;
import
org.opencv.imgcodecs.Imgcodecs;
import
org.opencv.imgproc.Imgproc;
public
class
GFG {
public
static
void
main(String[] args)
{
try
{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat source = Imgcodecs.imread(
"E:\\input.jpg"
,
Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
Mat destination
=
new
Mat(source.rows(), source.cols(),
source.type());
Imgproc.equalizeHist(source, destination);
Imgcodecs.imwrite(
"E:\\output.jpg"
,
destination);
System.out.print(
"Image Successfully Contrasted"
);
}
catch
(Exception e) {
System.out.println(
"error: "
+ e.getMessage());
}
}
}