Example usage for org.opencv.imgproc Imgproc Laplacian

List of usage examples for org.opencv.imgproc Imgproc Laplacian

Introduction

In this page you can find the example usage for org.opencv.imgproc Imgproc Laplacian.

Prototype

public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale, double delta) 

Source Link

Usage

From source file:interactivespaces.activity.image.vision.opencv.outline.ImageOpenCvVisionOutlineActivity.java

License:Apache License

/**
 * Detect all the edges in the image and make only the edges visible.
 *
 * @param image//from  w ww .ja  va2s  .c om
 *          the image to be processed
 * @param dst
 *          the destination image
 */
private void edgeify(Mat image, Mat dst) {
    Mat gray = new Mat();
    Imgproc.cvtColor(image, gray, Imgproc.COLOR_RGB2GRAY);

    Imgproc.medianBlur(gray, gray, BLUR_FILTER_SIZE);

    Mat edges = new Mat();
    Imgproc.Laplacian(gray, edges, CvType.CV_8U, LAPLACIAN_KERNEL_SIZE, 1, 0);

    Imgproc.threshold(edges, dst, EDGES_THRESHOLD, MAXIMUM_THRESHOLD_VALUE, Imgproc.THRESH_BINARY_INV);
}