Detecting silver coins on a carpet with camera mounted to iRobot Create

asked 2015-03-08 13:23:05 -0500

Hello! I'm trying to detect silver coins on a carpet (I know what the carpet looks like). The camera is going to be mounted to an iRobot Create. I took 20 pictures of the coins (quarters, nickels and dimes) at approximately the angle the camera will be mounted at on the Create (it isn't mounted yet). I also took 20 pictures of the carpet without the coins to use as the negative images.

I ran the command:

opencv_createsamples -info positives.txt -vec positives.vec -num 20 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -w 50 -h 50

Then I ran:

opencv_traincascade -data output_xml -vec positives.vec -bg negatives.txt -numStages 10 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 20 -numNeg 20 -w 80 -h 40 -mode ALL -precalcValBufSize 2048 -precalcIdxBufSize 2048

It only completed three stages then said the max false alarm rate had been reached. When I used opencv's facedetect to test the .xml file, there were many circles where there we no coins:

./facedetect --scale=2 --cascade="cascade.xml"

Am I taking the right approach to trying to detect coins on a carpet?

Thanks!

edit retag flag offensive close merge delete

Comments

It is a possible approach but off course 20 images will not allow you to train a very decent classifier. You need more examples to reach a good working model. But if your background is known, then is it really neccesary to train an object model. Isn't it better to perform background segmentation and then look for circular blobs or something like that? Don't make it over complicated if it is not needed!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-09 07:44:49 -0500 )edit

Good idea! Computer vision is totally new to me. Do you have any tips on doing the background segmentation and circular detection?

Aspiring_roboticist gravatar imageAspiring_roboticist ( 2015-03-09 10:38:56 -0500 )edit

I guess you need to read up on background subtraction algorithms and hough circle detection!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-09 14:17:43 -0500 )edit