bbenligiray / stag

STag: A Stable Fiducial Marker System
MIT License
187 stars 52 forks source link

STag Marker not being detected on cropped image #24

Closed udit7395 closed 2 years ago

udit7395 commented 2 years ago

Hi,

Firstly, thanks for making the library open-source. It's working great, especially on devices with limited computational resources like RPI-4. Currently, I am getting around an average of 9 FPS when the STAG marker detection algorithm is running on the images captured by the OAK-D camera at 720p resolution 60 FPS. Lowering the resolution to 400p increased the FPS. Hence I tried cropping a part of the image and then running the STAG marker detection algorithm but as you can see in the image below the marker was not detected. The marker is not detected for the cropped image but is detected on the uncropped image. If I downsize the image the marker is detected although it is not robust which is expected. I looked into the code to debug this issue but could not figure out why? Is there an input size limitation? Do you have any suggestions as to why this might be happening?

My final plan is to first run the marker detection on the whole image and then use some tracking algorithm to track the marker. The marker detection would run on the tracked part of the image. After every few seconds, I would run the marker detection algorithm on the whole image to update tracking. This way it should be less intensive on the CPU as the image size would be smaller.

image (1)

Thanks

bbenligiray commented 2 years ago

Hi Udit. I don't recall any reason for the marker in the cropped image to not be detected. You can try running https://github.com/bbenligiray/stag/blob/master/src/Stag.cpp#L48 after detectMarkers() to draw the intermediary steps, which may help in debugging.

udit7395 commented 2 years ago

@bbenligiray Thanks you. Through debugging I saw unnecessary lines being draw by ED. My guess was that image had too much noise or there was less contrast in the image. I applied histogram equalization to the image before passing it to STag marker detection and now it is working as expected.

I am closing this issue. Thanks once again.