This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

The ordering of your extracted points is jumping. If the rect is in the left part of the image, the green axis is pointing right out of the plane and everything looks ok. In other cases, the green and red axis look as if the both have an angle of 45 deg to your pattern. In this situation, solvePnP thinks that the pattern is held so that the longer side is held vertical but tilted.

Could you add labels for the points in inputContour? If you assign the 2d and 3d points incorrectly, the pose will just flip.

2 | No.2 Revision |

The ordering of your extracted points is jumping. If the rect is in the left part of the image, the green axis is pointing right out of the plane and everything looks ok. In other cases, the green and red axis look as if the both have an angle of 45 deg to your pattern. In this situation, solvePnP thinks that the pattern is held so that the longer side is held vertical but tilted.

Could you add labels for the points in ~~inputContour? ~~inputContour (cv::puttext)? If you assign the 2d and 3d points incorrectly, the pose will just flip.

3 | No.3 Revision |

The ordering of your extracted points is jumping. If the rect is in the left part of the image, the green axis is pointing right out of the plane and everything looks ok. In other cases, the green and red axis look as if the both have an angle of 45 deg to your pattern. In this situation, solvePnP thinks that the pattern is held so that the longer side is held vertical but tilted.

Could you add labels for the points in inputContour (cv::puttext)? If you assign the 2d and 3d points incorrectly, the pose will just flip.

In one configuration, the height of the object is assumed to be 1.4 at a distance of about 5.4, in the other the height is assumed to be 2 at a distance of about 7.2. (and 7.2/5.4 ~ 2/1.4) which is also a hint that this is really the problem.

However, the units really look strange.

4 | No.4 Revision |

Could you add labels for the points in inputContour (cv::puttext)? If you assign the 2d and 3d points incorrectly, the pose will just flip.

In one configuration, the height of the object is assumed to be 1.4 at a distance of about 5.4, in the other the height is assumed to be 2 at a distance of about 7.2. ~~(and ~~ 7.2/5.4 ~ ~~2/1.4) ~~2/1.4 which is also a hint that this is really the problem.

However, the units really look strange.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.