(-215:Assertion failed) img.type() == CV_8UC1
# you have to convert image to gray
grayimg = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
(-215:Assertion failed) img.type() == CV_8UC1
# you have to convert image to gray
grayimg = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
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()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us