Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

Add a new aruco image

0 votes

Hi... just got my first Jevois a few days ago and amazed by it.  But I am somewhat new to image processing and I am finding myself on the steep edge of the learning curve.

I need to identify a target that is a white square within a black square - very much like an ArUco image but all white on the inside.

I have experimented with Object Detect http://jevois.org/moddoc/ObjectDetect/modinfo.html  I have got this working but the camera is going to be on a pretty unstable platform and this seems to affect its ability to reliably identify the target.

Also, Saliency Surf http://jevois.org/moddoc/SaliencySURF/modinfo.html looks awesome and I suspect I will ultimately use it but it is susceptible to false positives which will cause problems.

So my attention has turned to ArUco.  It is super fast and accurate but the shape I am looking for is not an ArUco image - but it looks a lot like one.  

My question is how do I add a custom ArUco image to the library; or just replace the standard library with my own image?  I can't work out how to do it.

I thought it may have been like Object Detect where I just stick the image of interest in a subdirectory and it works but it appears to be more complex and possibly undefined.

Alternatively, can anyone recommend a different approach that I should try?

Thanks in advance.

Dave

asked Sep 6, 2019 in Programmer Questions by DaveA (290 points)

1 Answer

+1 vote
 
Best answer
Good question! With SURF key points (ObjectDetect or SaliencySurf), the problem will be that your shape is not very unique in the world, and hence you may get lots of false positives.

For ArUco, in part the algorithm is robust because of the more complex and carefully crafted shapes in the dictionary. So you may not get the same level of robustness with your shape. I don't think ArUco supports custom shapes, but I believe ARtoolkit (which we also support) does. However, you may still have issues with false alarms with that simple shape.

I wonder whether this one would be a good starting point: http://jevois.org/moddoc/FirstPython/modinfo.html

also see https://www.youtube.com/watch?v=BaWostkMClA

In there, we try to detect a U shape. If you edit the code in JeVois Inventor, have a look at lines 160 and later. This is where we enforce that the shape should look like a U:

- first, its convex hull should be quadrilateral

- then its area should be within some range (you can remove that test if you want)

- then (lines 179-180), the shape contour approximated as a polygon should have 8 vertices (replace that by 4)

- finally (lines 183-186), we check that the approximate polygon matches the fully detailed shape quite well. You could remove that first, then play with it later.

To understand this code, you need to look at the OpenCV docs:

https://docs.opencv.org/4.1.1/dd/d49/tutorial_py_contour_features.html

Also you may want to look online for "OpenCV shape detection python", and see, eg,

https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/
answered Sep 6, 2019 by JeVois (46,580 points)
selected Sep 10, 2019 by DaveA
Thanks!  This inspired me to really get into it; open cv, python, etc.  I ended up writing my own python module using open cv's shape detection to search for squares.  It works REALLY well.
great news! maybe you can post some pics or video or code at some point, to inspire the next generation!
...