Veebhor Jain
Veebhor Jain

Reputation: 3

ArUco Marker Detection behavior in different cases with noisy object in background

Python Version: 3.7

OpenCV Version: 4.1.1 / 3.4.X

Mobile Phone: Asus Zenfone Max Pro M1

Initial Setup

Screenshot of plotted image

Dictionary used : cv2.aruco.DICT_ARUCO_ORIGINAL .

Aruco Parameters [Edit 9th Dec, 19]:

parameters = cv2.aruco_DetectorParameters.create()
parameters.cornerRefinementMaxIterations = 80
parameters.cornerRefinementMethod = 1
parameters.polygonalApproxAccuracyRate = 0.05
parameters.cornerRefinementWinSize = 20
parameters.cornerRefinementMinAccuracy = 0.05
parameters.perspectiveRemovePixelPerCell = 8
parameters.maxErroneousBitsInBorderRate = 0.04
parameters.errorCorrectionRate = 0.2
parameters.adaptiveThreshWinSizeStep= 3
parameters.adaptiveThreshWinSizeMax= 23

The red marks show rejected points, while the green marks show the corner points.

Screenshot of aruco detection on image. No corners were detected in this case but lots of rejected points.

Case 1: Effects of Cropping

Cropped Image: 200 to 1574 on Y-axis and 883 to 2633 on X-axis. I cropped it using OpenCV so that there is no loss.

There were some instances where it detected the corner points and some instances where it captured more noise than before.

Screenshot of aruco detection on cropped image. In this case, there are more rejected points than before.

Case 2: Effects of Smoothing

I used Median Blur of 11x11 kernel on this image. The false detection was low and the marker was detected perfectly.

Initially I assumed that it was due to the noise removal in image after applying Median Blur, but the results did not improve by gradually increasing/decreasing the kernel size. For e.x: for one image, corners got detected using 9x9 filter but not using 5x5, 7x7, 11x11, 15x15. On another image, it might work using 11x11.

Screenshot of aruco detection after noise removal, zoomed for convenience.

I can't post the original image here since it is more than 2MB.

Upvotes: 0

Views: 2067

Answers (1)

Kanish
Kanish

Reputation: 546

What I don't understand is, why do the rejected points change?

If you check "detectMarkers" function in the OpenCV library, it applies adaptive thresholding by selecting small windows in the image. This number of small windows is defined as follows:

// number of window sizes (scales) to apply adaptive thresholding
int nScales =  (params->adaptiveThreshWinSizeMax - params->adaptiveThreshWinSizeMin) /
                      params->adaptiveThreshWinSizeStep + 1;

Even if you crop in, unless you change these parameters, the image processing is going to break your image into the same number of small windows. This is going to change (may decrease or increase) the number of total (accepted + rejected) candidates detected.

Why does it behave that way?

Again, this is the same reason. When you smoothen the image, the way adaptive thresholding gets applied changes.

I think it would be great if you change the marker to a one that has more concave black areas. This is just a suggestion since center part of the marker is mostly a white square, while your other white pieces of the paper are also mostly white squares.

Upvotes: 0

Related Questions