Ask Your Question
0

define marker and detect the number of markers

asked 2016-07-02 10:52:13 -0600

benz gravatar image

updated 2016-07-04 23:30:51 -0600

We need print several shape or marker in a special object, then we do a detection to calculate the number of markers. After research from many tutorials, I have the following questions,

  • What marker should I print.

The object is a rectangle shape, I can define the marker to print, I think it's better to print circles on the surface, what shape do you recommend?

  • How to find the markers

I learnt a lot from feature2d, historam match and template match, as well as ORB, LBP, BRISK,FREAK,SIFT, SURF etc. But these detect and compute methods seems not so good for this case.

  • How to define the features?

can we use pre-defined feature set to detect the target markers?

  • How to find the ROI

I have an idea, I don't know if it is feasible. I use the camera to take an background image firstly, then after capture the object, use minus to get the object. Mat background (from camera); Mat withObject (from camera); Mat target = withObject - background; after do that, I can see there is no background now. However, I don't how to figure out the shape of object. seems I can use the following code:

int threhold = 1;//the original background is 0

threhold(withObject , outputMat, threhold, 255, CV_BINARY_INV);

findContours(....)

Thanks a lot for your advices in advanced.

EDITS. This is my object to be detected. The marker is ARUCO markers image description

EDITS 2. My print version of image by ARUCO marker image description

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2016-07-02 14:00:02 -0600

Tetragramm gravatar image

updated 2016-07-03 09:03:00 -0600

Take a look at the OpenCV contrib modules, especially the ARUCO module. It has a marker system and functions built in to detect, track, print, and otherwise use them.

ARUCO Tutorials

ARUCO Documentation

EDIT: Here are the results from using the tutorial on your image. You can see it found all the markers, though one isn't in the DICT_ARUCO_ORIGINAL dictionary. If you only used markers from that, it would find them all.

image description

edit flag offensive delete link more

Comments

I tested aruco, the detection results are very bad. firstly, I created marker(ARUCO_MIP_36h12) file by aruco_print_marker.exe, then I used MS paint to create an image, pasted several ARUCO_MIP_36h12 markers in a white board, save it. after that, I used aruco_simple.exe to detect, only one is found. This is unacceptable.

benz gravatar imagebenz ( 2016-07-03 03:51:04 -0600 )edit
benz gravatar imagebenz ( 2016-07-03 03:59:46 -0600 )edit
1

I don't know what you're doing, but it doesn't resemble the tutorials I linked. The simple detect_markers.cpp from the samples finds all the instances that are in the dictionary, which one of those two is. The more complicated one isn't. So I suggest using the create_marker.cpp sample to make your markers, using ones that are in the OpenCV dictionary.

Tetragramm gravatar imageTetragramm ( 2016-07-03 09:01:07 -0600 )edit

I used code from sourceforge, because I have downloaded the source code before this thread. it seems I have made some mistakes. Thanks so much, Tetragramm, I will try to print those markers to the target then make a try tomorrow.

benz gravatar imagebenz ( 2016-07-03 09:41:57 -0600 )edit

when I try to use different params as input to detect the markers, both aruco2.0.7 and contrib-3.1.0-aruco are not so good, because my print quality is not so good. so I take a look into the source code of 2.0.7, it uses findContours to find contours, then judge if it is a rectangle by check if approxCurve = 4. oh, opencv contrib can be coded like that?

I want to give up ARUCO now.

benz gravatar imagebenz ( 2016-07-04 23:23:26 -0600 )edit

If you can't separate white and black, you're going to have problems no matter what marker system you use. Good luck though.

Tetragramm gravatar imageTetragramm ( 2016-07-05 07:37:21 -0600 )edit

Thank you, Tetragramm, I hope I can find other way around.

benz gravatar imagebenz ( 2016-07-07 20:31:04 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-02 10:52:13 -0600

Seen: 2,180 times

Last updated: Jul 04 '16