This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the image from directory | |
Mat image = Highgui.imread("C:path/to/input/image.tif"); | |
// Convert image to gray scale | |
System.out.println("Converting input image to gray scale"); | |
Mat grayImage = new Mat(); | |
Imgproc.cvtColor(image, grayImage, Imgproc.COLOR_BGR2GRAY); | |
// Save the transformed image | |
String filename = "resultImage.png"; | |
System.out.println(String.format("Writing %s", filename)); | |
Highgui.imwrite(filename, grayImage); |
No comments:
Post a Comment