Example usage for org.opencv.core Mat get

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

Introduction

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

Prototype

public double[] get(int row, int col) 

Source Link

Usage

From source file:xored.vpn.fixer.TokenDetector.java

private Mat addTo(Mat matA, List<Mat> mats) {
    Mat m = new Mat(matA.rows(), matA.cols(), matA.type());
    for (int i = 0; i < matA.rows(); i++) {
        for (int j = 0; j < matA.cols(); j++) {
            m.put(i, j, matA.get(i, j));
        }//  w w w. j  a  va2  s.c  o  m
    }
    int xOffset = 0;
    for (Mat mat : mats) {
        for (int i = 0; i < mat.rows(); i++) {
            for (int j = 0; j < mat.cols(); j++) {
                double[] v = mat.get(i, j);
                if (v.length == 1) {
                    double[] v1 = { v[0], v[0], v[0] };
                    m.put(i, j + xOffset, v1);
                } else {
                    m.put(i, j + xOffset, v);
                }
            }
        }
        xOffset += mat.cols() + 10;
    }

    return m;
}