How to find top piece in a pile

asked 2015-06-28 16:00:57 -0500

davewithheld gravatar image

I'm searching for this part in an image like this. I need to find the topmost part (the one that is unobscured) so I can pick it up with a suction cup. I have put together an explanation of what I have tried on a web page HERE.

Basically, I have tried feature detection, description and matching, with no success. I found the topmost part successfully by rotating the image 359 times and using matchTemplate on each rotation. Very accurate, but VERY slow.

Can someone recommend an algorithm that can accurately and quickly (< 10 secs) locate the top part?

edit retag flag offensive close merge delete

Comments

Template matching seems best in this case, since it is a very specific object that you need. To speed it up try to evaluate if rotating over like 10 degrees at a time would not work? Feature matching will never work since it are all identical items with the same identical keypoints.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-29 06:41:34 -0500 )edit

I tried going more degrees and fewer rotations, also tried successive approximation. I can speed it up, some, but not as accurate and still not quite fast enough. I'm thinking the pre-rotated template might work, but I still haven't given up on feature-based. There are a LOT of options. Thanks for telling me what I didn't want to hear.

davewithheld gravatar imagedavewithheld ( 2015-06-29 09:12:27 -0500 )edit

you are welcome ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-29 13:36:51 -0500 )edit
2

I timed my 360 rotations / matches and found the rotations took 10 secs and the matchTemplate calls took 80 secs. I loaded the images with CV_LOAD_IMAGE_GRAYSCALE and was surprised at how linear the reduction was: 3.3 secs for the rotation and 26.67 secs for the matches, reducing the whole process to 1/3 the time for 1/3 the data. I also found that reducing the size of the images by 1/2 caused no degradation in accuracy and reduced the overall time to about 7 seconds! Reducing the size further started to introduce some errors, but I was able to go down to 0.25 of the original size and still have enough accuracy to find my parts in < 1.5 seconds!

Although I have a working method, I'm leaving this open in hopes someone will have a feature-based method that will have high accy AND speed

davewithheld gravatar imagedavewithheld ( 2015-07-10 22:56:51 -0500 )edit