Aruco Marker Corners Occasionally Mislocated
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
Which corners refinement method are you using? Try the others.
My advice is to use AprilTag3. Slower but more accurate than Aruco.
Identical results for "None" and "Subpix". "Contour" gives more significant figures but rounds to the same pixel.
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...
I'm using OpenCV 3.4.1