# Revision history [back]

### Weird ArUco marker behavior

It is the first time I worked with ArUco markers and was disappointed by weird distortion after perspective transformation based on recognized markers. I assumed that its because of camera calibration errors and decided to test with "ideal" markers.

I calibrated camera with pattern file (not printed and photographed, but just from a source file). Then I generated my marker and put it on JPG image without any distortions. My program found the marker, I generated new position for marked and warped the image:

    int side = 100;
resultCorners.push_back(corners[0][0]);
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y));
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y + side));
resultCorners.push_back(Point2f(corners[0][0].x, corners[0][0].y + side));
Mat w = getPerspectiveTransform(corners[0], resultCorners);
warpPerspective(img_copy, result, w, img_copy.size());


That worked OK: 1.PNG

Then I minimized source image with one pyrDown call and tried to recognize marker again:

2.PNG

Could you please explain, why this weird distortion happens?

### Weird ArUco marker behavior

It is the first time I worked with ArUco markers and was disappointed by weird distortion after perspective transformation based on recognized markers. I assumed that its because of camera calibration errors and decided to test with "ideal" markers.

I calibrated camera with pattern file (not printed and photographed, but just from a source file). Then I generated my marker and put it on JPG image without any distortions. My program found the marker, I generated new position for marked and warped the image:

    int side = 100;
resultCorners.push_back(corners[0][0]);
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y));
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y + side));
resultCorners.push_back(Point2f(corners[0][0].x, corners[0][0].y + side));
Mat w = getPerspectiveTransform(corners[0], resultCorners);
warpPerspective(img_copy, result, w, img_copy.size());


That worked OK: 1.PNG

Then I minimized source image with one pyrDown call and tried to recognize marker again:

2.PNG

Could you please explain, why this weird distortion happens?happens and how I can avoid it in real situation with photo or video stream?

### Weird ArUco marker behavior

It is the first time I worked with ArUco markers and was disappointed by weird distortion after perspective transformation based on recognized markers. I assumed that its because of camera calibration errors and decided to test with "ideal" markers.

I calibrated camera with pattern file (not printed and photographed, but just from a source file). Then I generated my marker and put it on JPG image without any distortions. My program found the marker, I generated new position for marked and warped the image:

    int side = 100;
resultCorners.push_back(corners[0][0]);
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y));
resultCorners.push_back(Point2f(corners[0][0].x + side, corners[0][0].y + side));
resultCorners.push_back(Point2f(corners[0][0].x, corners[0][0].y + side));
Mat w = getPerspectiveTransform(corners[0], resultCorners);
warpPerspective(img_copy, result, w, img_copy.size());


That worked OK: 1.PNG

Then I minimized source image with one pyrDown call and tried to recognize marker again:

2.PNG

Could you please explain, why this weird distortion happens and how I can avoid it in real situation with photo or video stream?

UPDATE: On the left is a source image, on the right - a destination. I find marker on both to make sure that code above turns source image in orthogonal projection to camera. I assume I should use vectors that I receive from estimatePoseSingleMarkers here, but for now I'm just confused with distortion of markers detected in source image.