Ask Your Question

Weird ArUco marker behavior

asked 2017-03-28 15:34:43 -0600

tischenkoalex gravatar image

updated 2017-03-28 23:13:20 -0600

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(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:


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.

edit retag flag offensive close merge delete


In the second image, which is crooked, the source, or the result?

It looks like the marker in the source image isn't quite square. Which would obviously cause the result to be at least a little warped. Either that, or the detection is a bit off. I can't tell if it's the marker or just the detection box.

Tetragramm gravatar imageTetragramm ( 2017-03-28 17:56:16 -0600 )edit

The second image is a result (on the right). 1.png ans 2.png are two attempts, where 2.png is just a little bit smaller. I just got idea to play with detection params.

tischenkoalex gravatar imagetischenkoalex ( 2017-03-28 22:54:11 -0600 )edit

Right, but in 2.png, is it the source image or just the detection box that is crooked? Since the detection box is drawn on top I can't see the original image.

Tetragramm gravatar imageTetragramm ( 2017-03-28 23:13:55 -0600 )edit

Only detection box. Here are both source images:

tischenkoalex gravatar imagetischenkoalex ( 2017-03-29 00:39:28 -0600 )edit

Yeah... that's blurring makes such result, just tested with the same size, just blurred image. Now wondering how to fix this situation, because in real photo there is always some portion of blurring.

tischenkoalex gravatar imagetischenkoalex ( 2017-03-29 00:43:17 -0600 )edit

Are you doing cornerSubPix? That may either help or hurt.

Or perhaps the refineDetectedMarkers function? Again, not sure if it would help or hurt.

Tetragramm gravatar imageTetragramm ( 2017-03-29 18:16:09 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-30 04:24:14 -0600

tischenkoalex gravatar image

It looks like these could help, I'll try to play with them after I solve the problem which most likely gives the most distortion for me -

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-03-28 15:34:43 -0600

Seen: 493 times

Last updated: Mar 28 '17