Example usage for org.opencv.core Mat copyTo

List of usage examples for org.opencv.core Mat copyTo

Introduction

In this page you can find the example usage for org.opencv.core Mat copyTo.

Prototype

public void copyTo(Mat m, Mat mask) 

Source Link

Usage

From source file:View.PreprocessSignature.java

private static Mat doCanny(Mat frame) {
    // init/*from ww w. j ava 2 s. c  o m*/
    Mat grayImage = new Mat();
    Mat detectedEdges = new Mat();

    // convert to grayscale
    Imgproc.cvtColor(frame, grayImage, Imgproc.COLOR_BGR2GRAY);

    // reduce noise with a 3x3 kernel
    Imgproc.blur(grayImage, detectedEdges, new Size(3, 3));

    // canny detector, with ratio of lower:upper threshold of 3:1
    //Imgproc.Canny(detectedEdges, detectedEdges, this.threshold.getValue(), this.threshold.getValue() * 3);
    Imgproc.Canny(detectedEdges, detectedEdges, 6, 6 * 3);

    // using Canny's output as a mask, display the result
    Mat dest = new Mat();
    frame.copyTo(dest, detectedEdges);

    return dest;
}