Ransac-2d-Shape-Detection icon indicating copy to clipboard operation
Ransac-2d-Shape-Detection copied to clipboard

Asseertion failed: selection.size()!=0

Open zikai1 opened this issue 5 years ago • 1 comments

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:

QQ图片20200105095901

How can I solve this problem, thanks very much!

zikai1 avatar Jan 05 '20 02:01 zikai1

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.

zikai1 avatar Jan 05 '20 03:01 zikai1