Detecting silver coins on a carpet with camera mounted to iRobot Create
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!
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!
Good idea! Computer vision is totally new to me. Do you have any tips on doing the background segmentation and circular detection?
I guess you need to read up on background subtraction algorithms and hough circle detection!