Example usage for org.opencv.core MatOfPoint3f put

List of usage examples for org.opencv.core MatOfPoint3f put

Introduction

In this page you can find the example usage for org.opencv.core MatOfPoint3f put.

Prototype

public int put(int row, int col, double... data) 

Source Link

Usage

From source file:com.android.cts.verifier.sensors.RVCVXCheckAnalyzer.java

License:Apache License

/**
 * Generate pattern geometry like this one
 * http://docs.opencv.org/trunk/_downloads/acircles_pattern.png
 *
 * @return Array of 3D points/*  w w  w  .j  a  v  a  2s  . com*/
 */
private MatOfPoint3f asymmetricalCircleGrid(Size size) {
    final int cn = 3;

    int n = (int) (size.width * size.height);
    float positions[] = new float[n * cn];
    float unit = 0.02f;
    MatOfPoint3f grid = new MatOfPoint3f();

    for (int i = 0; i < size.height; i++) {
        for (int j = 0; j < size.width * cn; j += cn) {
            positions[(int) (i * size.width * cn + j + 0)] = (2 * (j / cn) + i % 2) * (float) unit;
            positions[(int) (i * size.width * cn + j + 1)] = i * unit;
            positions[(int) (i * size.width * cn + j + 2)] = 0;
        }
    }
    grid.create(n, 1, CvType.CV_32FC3);
    grid.put(0, 0, positions);
    return grid;
}