Example usage for org.opencv.core Mat eye

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

Introduction

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

Prototype

public static Mat eye(int rows, int cols, int type) 

Source Link

Usage

From source file:org.usfirst.frc.team2084.CMonster2016.vision.CoordinateMath.java

License:Open Source License

/**
 * Rotate a point around the x axis and store the result in another point.
 * /*from w ww  .  j  a v a 2 s  .  c om*/
 * @param point the point to rotate
 * @param destPoint the output point
 * @param angle the angle to rotate (in radians)
 */
public static void rotateX(Mat point, Mat destPoint, double angle) {
    Mat rotateMat = Mat.eye(3, 3, point.type());

    double c = Math.cos(angle);
    double s = Math.sin(angle);

    rotateMat.put(1, 1, c);
    rotateMat.put(1, 2, -s);
    rotateMat.put(2, 1, s);
    rotateMat.put(2, 2, c);

    matMult(rotateMat, point, destPoint);
}

From source file:org.usfirst.frc.team2084.CMonster2016.vision.CoordinateMath.java

License:Open Source License

/**
 * Rotate a point around the y axis and store the result in another point.
 * /*  w  ww  .  j  a  v  a 2s.  co  m*/
 * @param point the point to rotate
 * @param destPoint the output point
 * @param angle the angle to rotate (in radians)
 */
public static void rotateY(Mat point, Mat destPoint, double angle) {
    Mat rotateMat = Mat.eye(3, 3, point.type());

    double c = Math.cos(angle);
    double s = Math.sin(angle);

    rotateMat.put(0, 0, c);
    rotateMat.put(0, 2, s);
    rotateMat.put(2, 0, -s);
    rotateMat.put(2, 2, c);

    matMult(rotateMat, point, destPoint);
}

From source file:org.usfirst.frc.team2084.CMonster2016.vision.CoordinateMath.java

License:Open Source License

/**
 * Rotate a point around the z axis and store the result in another point.
 * /*ww w .  jav a2 s  .c  om*/
 * @param point the point to rotate
 * @param destPoint the output point
 * @param angle the angle to rotate (in radians)
 */
public static void rotateZ(Mat point, Mat destPoint, double angle) {
    Mat rotateMat = Mat.eye(3, 3, point.type());

    double c = Math.cos(angle);
    double s = Math.sin(angle);

    rotateMat.put(0, 0, c);
    rotateMat.put(0, 1, -s);
    rotateMat.put(1, 0, s);
    rotateMat.put(1, 1, c);

    matMult(rotateMat, point, destPoint);
}