0
votes

I was trying to use the OpenCV HoughCircles function, but I got this error. this my code:

rows = image.shape[0]
circles = cv2.HoughCircles(out_img, cv2.HOUGH_GRADIENT, 1, rows / 8,
                           param1=100, param2=30,
                           minRadius=1, maxRadius=30)

and the error:

OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-10658tfl\opencv\modules\imgproc\src\hough.cpp:2253: error: (-215:Assertion failed) !_image.empty() && _image.type() == CV_8UC1 && (_image.isMat() || _image.isUMat()) in function 'cv::HoughCircles'

1

1 Answers

0
votes

So it's one of many options, either the input image you're using is None (failed to read the image) or your image has 3 channels not 1 according to this