Answers for "(-215:Assertion failed) _src.depth() == CV_8U in function 'Canny'"

20

error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

This error happened because the image didn't load properly.
So you have a problem with the previous line cv2.imread my suggestion is :

Check if the images exist in the path you give

Check the count variable to see if it has a valid number
Posted by: Guest on March-09-2020
0

(-215:Assertion failed) img.type() == CV_8UC1 in func

img_blur = cv2.medianBlur(self.cropped_img,5).astype('uint8')
img_thresh_Gaussian = cv2.adaptiveThreshold(img_blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)
Posted by: Guest on June-19-2020
0

open cverror: (-215:Assertion failed) src.type() == CV_8UC1 in function 'cv::adaptiveThreshold'

from keras.preprocessing import image
import cv2
import matplotlib.pyplot as plt

img = image.load_img('15f8U.png', grayscale=True, target_size=(224, 224))
img = image.img_to_array(img, dtype='uint8')

print(img.shape)
## output : (224,224,3)
#plt.imshow(img_grey)

th3 = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2)
plt.figure(figsize=(20,10))
plt.imshow(th3, cmap="gray")
plt.show()
Posted by: Guest on May-01-2021

Code answers related to "(-215:Assertion failed) _src.depth() == CV_8U in function 'Canny'"

Browse Popular Code Answers by Language