@@ -0,0 +1,1458 @@
+import java.awt.image.BufferedImage;%0Aimport java.awt.image.DataBufferByte;%0Aimport java.io.File;%0Aimport javax.imageio.ImageIO;%0Aimport org.opencv.core.Core;%0Aimport org.opencv.core.CvType;%0Aimport org.opencv.core.Mat;%0Aimport org.opencv.imgproc.Imgproc;%0A%0Apublic class ImageResizer %7B%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%09%09ImageResize imageResize = new ImageResize();%0A%0A%09%09try %7B%0A%09%09%09System.loadLibrary(Core.NATIVE_LIBRARY_NAME);%0A%09%09%09File input = new File(%22/home/marjan/Pictures/digits.jpg%22);%0A%09%09%09BufferedImage image = ImageIO.read(input);%0A%09%09%09%0A%0A%09%09%09byte%5B%5D data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();%0A%09%09%09Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3);%0A%09%09%09mat.put(0, 0, data);%0A%0A%09%09%09Mat mat1 = new Mat(0, 0, CvType.CV_8UC1);%0A%09%09%0A%09%09%09Imgproc.cvtColor(mat, mat1, Imgproc.COLOR_RGB2GRAY);%0A%0A%09%09%09byte%5B%5D data1 = new byte%5Bmat1.rows() * mat1.cols() * (int) (mat1.elemSize())%5D;%0A%09%09%09mat1.get(0, 0, data1);%0A%09%09%09BufferedImage image1 = new BufferedImage(mat1.cols(), mat1.rows(), BufferedImage.TYPE_BYTE_GRAY);%0A%09%09%09image1.getRaster().setDataElements(0, 0, mat1.cols(), mat1.rows(), data1);%0A//%09%09%09Size size = new Size(100, 100);%0A//%09%09%09%0A//%09%09%09Imgproc.resize(mat, mat1, size);%0A//%09%09%09%0A%09%09%09File ouptut = new File(%22/home/marjan/Pictures/grayscale.jpg%22);%0A%09%09%09ImageIO.write(image1, %22jpg%22, ouptut);%0A%09%09%09imageResize.resize();%0A%09%09%09System.out.println(%22Image created%22);%0A%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09System.out.println(%22Error: %22 + e.getMessage());%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create ImageResizer.java