Example usage for org.opencv.core Mat assignTo

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

Introduction

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

Prototype

public void assignTo(Mat m) 

Source Link

Usage

From source file:gab.opencv.OpenCV.java

License:Open Source License

/**
 * Calculate the difference between the current image
 * loaded into OpenCV and a second image. The result is stored
 * in the loaded image in OpenCV. Works on both color and grayscale
 * images./* w ww.j a  v  a  2 s.c  om*/
 * 
 * @param img
 *       A PImage to diff against.
 */
public void diff(PImage img) {
    Mat imgMat = imitate(getColor());
    toCv(img, imgMat);

    Mat dst = imitate(getCurrentMat());

    if (useColor) {
        ARGBtoBGRA(imgMat, imgMat);
        Core.absdiff(getCurrentMat(), imgMat, dst);
    } else {
        Core.absdiff(getCurrentMat(), OpenCV.gray(imgMat), dst);
    }

    dst.assignTo(getCurrentMat());
}

From source file:gab.opencv.OpenCV.java

License:Open Source License

/**
 * A helper function that diffs two Mats using absdiff.
 * Places the result back into mat1 // w w w.ja v  a 2  s.  c  om
 * 
 * @param mat1
 *       The destination Mat
 * @param mat2
 *       The Mat to diff against
 */
public static void diff(Mat mat1, Mat mat2) {
    Mat dst = imitate(mat1);
    Core.absdiff(mat1, mat2, dst);
    dst.assignTo(mat1);
}

From source file:gab.opencv.OpenCVProcessingUtils.java

License:Open Source License

public void diff(PImage img) {
    Mat imgMat = imitate(getColor());/*from   w w w .ja  va2  s  .c om*/
    toCv(img, imgMat);

    Mat dst = imitate(getCurrentMat());

    if (useColor) {
        ARGBtoBGRA(imgMat, imgMat);
        Core.absdiff(getCurrentMat(), imgMat, dst);
    } else {
        Core.absdiff(getCurrentMat(), OpenCVProcessingUtils.gray(imgMat), dst);
    }

    dst.assignTo(getCurrentMat());
}

From source file:gab.opencv.OpenCVProcessingUtils.java

License:Open Source License

public static void diff(Mat mat1, Mat mat2) {
    Mat dst = imitate(mat1);
    Core.absdiff(mat1, mat2, dst);
    dst.assignTo(mat1);
}