Ransac-2d-Shape-Detection
Ransac-2d-Shape-Detection copied to clipboard
Asseertion failed: selection.size()!=0
Hi, I encountered a problem when I run this code to detect circles. I put some images in the same directory, but they had different suffix formats, such as 1.jpg, 2.png and so on. All the .jpg images could be detect rightly, but the above problem arised when detected .png images.
My environment is VS2013+Opencv 3.4, the problem is as following:
How can I solve this problem, thanks very much!
The problem is the setting of the threshold in Opencv The original setting in this code is : threshold(src,inImg,10,255,CV_THRESH_BINARY_INV); However, after this binary operation, the detection images become 0, since 10 is too small. I revise this operation to an adaptive format in Opencv: adaptiveThreshold(src, inImg, 255, 0, 1, 5, 10); Then it works.