Aruco Marker Corners Occasionally Mislocated

asked 2020-08-27 13:38:11 -0600

tkw954 gravatar image

updated 2020-08-28 11:34:46 -0600

I have a situation where my Aruco markers are occasionally mislocated so that the marker is undersized. When this happens (<5% of images), it happens to all the markers in an image.

Here's an example of two consecutive frames:

Frame 30 is correctly located: raw image zoomed in with red stars on corners

Frame 31 with markers identified as undersized (all three are similar): raw image zoomed in with corners

I'm doing this using the Matlab wrappers from https://github.com/kyamagu/mexopencv

Edit: identical results for the python wrappers

Everything uses defaults, here's my Matlab code:

dictionary = {'Predefined', '6x6_250'};
img=imread('frame31bad.png');

%detectorParams.cornerRefinementMethod = 'Subpix'; 
detectorParams.cornerRefinementMethod = 'Contour'; 
%detectorParams.cornerRefinementMethod = 'None';
[corners, ids, rejected] = cv.detectMarkers(img, dictionary,...
'DetectorParameters',detectorParams)


figure(2)
imshow(img)
hold all
for i=1:numel(corners)
    for j=1:4
        plot(corners{i}{j}(1),corners{i}{j}(2),'r*')
    end
end
hold off
edit retag flag offensive close merge delete

Comments

Which corners refinement method are you using? Try the others.

My advice is to use AprilTag3. Slower but more accurate than Aruco.

Eduardo gravatar imageEduardo ( 2020-08-28 08:44:18 -0600 )edit

Identical results for "None" and "Subpix". "Contour" gives more significant figures but rounds to the same pixel.

tkw954 gravatar imagetkw954 ( 2020-08-28 11:31:33 -0600 )edit

Which OpenCV version are you using? There is a CORNER_REFINE_APRILTAG flag also (in recent OpenCV version).

My recommendation is to use AprilTag 3.

Else try with the official Aruco lib. The lab that proposes the Aruco continues to work on it while the OpenCV Aruco has not been updated for years. Can be downloaded here. Beware of the license of the code. Sourceforge shows BSD while the code is actually licensed under GPLv3 and some part of the code is obfuscated...

Eduardo gravatar imageEduardo ( 2020-08-28 12:00:33 -0600 )edit

I'm using OpenCV 3.4.1

tkw954 gravatar imagetkw954 ( 2020-08-28 12:33:41 -0600 )edit