@@ -1786,16 +1786,16 @@ void drawDetectedMarkers(InputOutputArray _image, InputArrayOfArrays _corners,
17861786
17871787/* *
17881788 */
1789- void drawAxis (InputOutputArray _image, InputArray _cameraMatrix, InputArray _distCoeffs, InputArray _rvec,
1790- InputArray _tvec, float length, int thickness)
1789+ void drawCustomAxis (InputOutputArray _image, InputArray _cameraMatrix, InputArray _distCoeffs, InputArray _rvec,
1790+ InputArray _tvec, float length, int thickness, Point3f center, Point3f axisCoefficient )
17911791{
1792- vector<Point3f> axis ;
1793- axis .push_back (Point3f ( 0 . f , 0 . f , 0 . f ) );
1794- axis .push_back (Point3f (length, 0 .f , 0 .f ));
1795- axis .push_back (Point3f (0 .f , length, 0 .f ));
1796- axis .push_back (Point3f (0 .f , 0 .f , - length));
1792+ vector<Point3f> axis_points ;
1793+ axis_points .push_back (center );
1794+ axis_points .push_back (center+ Point3f (length*axisCoefficient. x , 0 .f , 0 .f ));
1795+ axis_points .push_back (center+ Point3f (0 .f , length*axisCoefficient. y , 0 .f ));
1796+ axis_points .push_back (center+ Point3f (0 .f , 0 .f , length*axisCoefficient. z ));
17971797 vector<Point2f> axis_to_img;
1798- projectPoints (axis , _rvec, _tvec, _cameraMatrix, _distCoeffs, axis_to_img);
1798+ projectPoints (axis_points , _rvec, _tvec, _cameraMatrix, _distCoeffs, axis_to_img);
17991799 line (_image, Point2i (axis_to_img[0 ]), Point2i (axis_to_img[1 ]), Scalar (255 ,0 ,0 ), thickness);
18001800 line (_image, Point2i (axis_to_img[0 ]), Point2i (axis_to_img[2 ]), Scalar (0 ,255 ,0 ), thickness);
18011801 line (_image, Point2i (axis_to_img[0 ]), Point2i (axis_to_img[3 ]), Scalar (0 ,0 ,255 ), thickness);
0 commit comments