I have to find multiple objects of one type in an image and for this purpose, I am using OpenCV (Python). First I started with Template matching which doesn't work well if the orientation of the image is changed.
So, I used the method described here. But, unfortunately, it is not working as expected and also, everytime I rerun my code, the output (i.e. the bounding box around the object detected) keeps changing.
Here is my output:
I have tweaked the values and I am still not getting the desired output. Why is it that 2/5 objects of the same type is detected, but not the rest? I have been thinking about ways to fix it for weeks now. I also tried bf.knnMatch instead of flann.knnMatch and SURF/SIFT instead of ORB, but still no luck.
Do you guys have any idea on how can I fix this? Any suggestions will be appreciated.
Note: I have not made any changes in the code given in the link