TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AutoVisionPickup.java
/**
     * This function will take in a set of 4 coordinates, and the corresponding camera image coordinate,
     * use OpenCV PerspectiveTransform to map image coordinate into field coordinate
     *
     ******************************
     *             0              *
     *                            *
     *                            *
     *  1                      2  *
     *                            *
     *             3              *
     *                            *
     *                            *
     *             R              *
     ******************************
     */
This function will take in a set of 4 coordinates, and the corresponding camera image coordinate,
use OpenCV PerspectiveTransform to map image coordinate into field coordinate

0

1                      2

3

R
This function will take in a set of 4 coordinates and the corresponding camera image coordinate use OpenCV PerspectiveTransform to map image coordinate into field coordinate 0 1 2 3 R
void generateProfile() {
        ArrayList<Point> imgList = new ArrayList<Point>();
        ArrayList<Point> fieldList = new ArrayList<Point>();
        imgList.add(new Point(284, 141));
        imgList.add(new Point(50, 209));
        imgList.add(new Point(561, 203));
        imgList.add(new Point(267, 361));
        fieldList.add(new Point(180 + ROBOT_WIDTH/2 * 2.54, 0));
        fieldList.add(new Point(120 + ROBOT_WIDTH/2 * 2.54, 40));
        fieldList.add(new Point(120 + ROBOT_WIDTH/2 * 2.54, -50));
        fieldList.add(new Point(60 + ROBOT_WIDTH/2 * 2.54, 0));
        Mat imgMat = Converters.vector_Point2f_to_Mat(imgList);
        Mat fieldMat = Converters.vector_Point2f_to_Mat(fieldList);
        trans = Imgproc.getPerspectiveTransform(imgMat, fieldMat);
        invTrans = Imgproc.getPerspectiveTransform(fieldMat, imgMat);
    }
void generateProfile ( ) { ArrayList < Point > imgList = new ArrayList < Point > ( ) ; ArrayList < Point > fieldList = new ArrayList < Point > ( ) ; imgList . add ( new Point ( 284 , 141 ) ) ; imgList . add ( new Point ( 50 , 209 ) ) ; imgList . add ( new Point ( 561 , 203 ) ) ; imgList . add ( new Point ( 267 , 361 ) ) ; fieldList . add ( new Point ( 180 + ROBOT_WIDTH / 2 * 2.54 , 0 ) ) ; fieldList . add ( new Point ( 120 + ROBOT_WIDTH / 2 * 2.54 , 40 ) ) ; fieldList . add ( new Point ( 120 + ROBOT_WIDTH / 2 * 2.54 , - 50 ) ) ; fieldList . add ( new Point ( 60 + ROBOT_WIDTH / 2 * 2.54 , 0 ) ) ; Mat imgMat = Converters . vector_Point2f_to_Mat ( imgList ) ; Mat fieldMat = Converters . vector_Point2f_to_Mat ( fieldList ) ; trans = Imgproc . getPerspectiveTransform ( imgMat , fieldMat ) ; invTrans = Imgproc . getPerspectiveTransform ( fieldMat , imgMat ) ; }
This function will take in a set of 4 coordinates, and the corresponding camera image coordinate,
 use OpenCV PerspectiveTransform to map image coordinate into field coordinate
This function will take in a set of 4 coordinates and the corresponding camera image coordinate use OpenCV PerspectiveTransform to map image coordinate into field coordinate