@@ -0,0 +1,1726 @@
+import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U;%0Aimport static org.bytedeco.javacpp.opencv_imgproc.CV_THRESH_BINARY;%0A%0Aimport java.awt.image.BufferedImage;%0Aimport java.awt.image.DataBufferByte;%0Aimport java.awt.image.WritableRaster;%0A%0Aimport org.opencv.core.Mat;%0Aimport org.opencv.core.Point;%0Aimport org.opencv.core.Size;%0Aimport org.opencv.imgproc.Imgproc;%0A%0A%0Apublic class ImageProcessing %7B%0A%0A%09%0A%09public static Mat toGreyscale(Mat source)%7B%0A%09%09Mat greyscale = new Mat();//(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.cvtColor(source, greyscale, Imgproc.COLOR_BGR2GRAY);%0A%09%09return greyscale;%0A%09%7D%0A%09public static Mat toCanny(Mat source)%7B%0A%09%09Mat canny = new Mat(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.Canny(source, canny, 100, 255, 3, false);%0A%09%09return canny;%0A%09%7D%0A%09public static Mat toThreshBinary(Mat source)%7B%0A%09%09Mat threshold = new Mat();//(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.threshold(source, threshold, 100, 255, Imgproc.THRESH_BINARY_INV);%0A%09%09return threshold;%0A%09%7D%0A%09%0A%09public static Mat toDilate(Mat source, int erosion_size)%7B%0A%09%09//int erosion_size = 3;%0A%09%09Mat element = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2 * erosion_size + 1, 2 * erosion_size + 1),%09new %0A%0APoint(erosion_size, erosion_size));%0A%09%09Mat dilateDes = new Mat(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.dilate(source, dilateDes, element);%0A%09%09return dilateDes;%0A%09%7D%0A%09%0A%09public static Mat toThreshBinaryTest(Mat source)%7B%0A%09%09Mat threshold = new Mat();//(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.threshold(source, threshold, 100, 255, Imgproc.THRESH_BINARY_INV);%0A%09%09return threshold;%0A%09%7D%0A%09%0A%09public static Mat toCannyTest(Mat source)%7B%0A%09%09Mat canny = new Mat(source.size(), IPL_DEPTH_8U);%0A%09%09Imgproc.Canny(source, canny, 100, 255, 3, false);%0A%09%09return canny;%0A%09%7D%0A%09%0A%0A%09%0A

Create ImageProcessing.java