3

I have an image where I want to detect aruco markers DICT_4X4_50. However, the image resolution seems to present itself as a major problem. But it is rather strange, since aruco detection function is able to detect markers on much difficult images, but not this one. Is there any way to detect them?

I already tried changing some parameter values of detector parameters, but it didn't help, and modifying values randomly does not seem to be the best option at all. This is the image: aruco markers bad resolution

This was my basic code:


import cv2
from cv2 import aruco

img = cv2.imread('image.png')

aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_50)
parameters = aruco.DetectorParameters_create()

# Detect the markers.
corners, ids, rejectedImgPoints = aruco.detectMarkers(img,aruco_dict,parameters=parameters)

out = aruco.drawDetectedMarkers(img, corners, ids)

cv2.imshow("out",out)
cv2.waitKey(0)
cv2.destroyAllWindows()

Thank you!

gonmrm
  • 89
  • 1
  • 6
  • 1
    The detection is rejecting all arucos by some strange reason. You can see [here](https://i.imgur.com/ueX7tmL.png) I plotted the rejected points. Are you sure you are using the correct dictionary? As you said, your image is not good, but not bad enough that aruco couldn't handle it. – Leonardo Mariga Aug 07 '19 at 12:48
  • Hi there @LeonardoMariga, thank you for your comment! That was actually a possibility, but now I tried in a loop every dictionary from aruco library, and none were able to detect the symbols. That plot you did is quite interesting. I am expecting that it is somehow possible to lower some threshold to tell the detector that those symbols are to be considered valid. – gonmrm Aug 08 '19 at 08:46
  • You can try, but I don't think threshold will solve your problem. Yesterday I changed some things in order to facilitate the detection. Here is what I tried (without success): I tried changing adaptiveThreshWinSizeMin, adaptiveThreshWinSizeMax - The result was another aruco (id = 871) detected when I used the 4x4_1000 dictionary, that is what I thought could be a dictionary problem. – Leonardo Mariga Aug 08 '19 at 11:10
  • I thought maybe could be the camera field of view that could be distorting the image, so I changed polygonalApproxAccuracyRate. I also tried to use a [sharpen filter](https://stackoverflow.com/a/38982869/11522398) to remove the blurriness but nothing changed at all. I tried messing with some morphology operators as [Eroding and Dilating](https://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html), which gave me 3 aruco detected at same time (best result so far). At last, I used an adaptive filter and contrast change but it rejected the arucos anyway. – Leonardo Mariga Aug 08 '19 at 11:21
  • 1
    When you discover your problem please let me know because I spent almost an hour trying to find a solution hahaha – Leonardo Mariga Aug 08 '19 at 11:26

2 Answers2

0

In you code you have not defined the detect markers code cv2.detectMarkers()

  • That function does not even exist, only cv2.aruco.detectMarkers(), which is being called. The problem is not on the way it is coded. One can just change the image for a better one and the markers will be found. The problem here is that aruco does not seem to manage this detection, which looks quite easy. So some extra image processing must be necessary, I guess. – gonmrm Apr 17 '20 at 07:41
0

Found the problem. Symbols are vertically rotated. If the image is flipped, it will be fine. :P No wonder Aruco could not solve that.

gonmrm
  • 89
  • 1
  • 6