Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void zad6() {
- Mat image = Imgcodecs.imread("img.jpg", IMREAD_GRAYSCALE);
- Mat src = new Mat();
- Mat dst = new Mat();
- Mat dst1 = new Mat();
- Mat dst3 = new Mat();
- Mat kontury = new Mat();
- Mat kontury1 = new Mat();
- Mat kontury2 = new Mat();
- final Size kernelSize = new Size(11, 11);
- Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, kernelSize);
- final Point anchor = new Point(-1, -1);
- final int iterations = 2;
- namedWindow("Ukasz", WINDOW_AUTOSIZE);
- imshow("Ukasz", image);
- waitKey(0);
- int x = 25;
- int y = 5;
- System.out.println("x: " + x);
- System.out.println("y: " + y);
- adaptiveThreshold(image, src, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, x, y);
- imshow("Output", src);
- waitKey(0);
- //pierwszy wzór
- Imgproc.dilate(src, dst, kernel, anchor);
- Core.subtract(dst, src, kontury);
- //drugi wzór
- Imgproc.erode(src, dst1, kernel, anchor);
- Core.subtract(src, dst1, kontury1);
- Core.subtract(dst, dst1, kontury2);
- namedWindow("kontury1", WINDOW_AUTOSIZE);
- imshow("kontury1", kontury);
- waitKey(0);
- namedWindow("kontury2", WINDOW_AUTOSIZE);
- imshow("kontury2", kontury1);
- waitKey(0);
- namedWindow("kontury3", WINDOW_AUTOSIZE);
- imshow("kontury3", kontury2);
- waitKey(0);
- System.exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement