I'm now in a program try to change pictures from normal to binaryzation.So i use opencv on python, but when i finish my problem in my home carry my code to my office it come up with a unknown error.So i come to here ,looking for help.
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import cv2
im = Image.open('card.jpg')
img = np.array(im)
if img.ndim == 3:
img = img[:, :,0]
plt.gray()
ret, thresh1 = cv2.threshold(img, 50, 255, cv2.THRESH_BINARY)
plt.subplot(222)
plt.imshow(thresh1)
plt.show()
The traceback is
Traceback (most recent call last): File "D:/tensorflow/opencv.py", line 12, in ret, thresh1 = cv2.threshold(img, 50, 255, cv2.THRESH_BINARY) TypeError: src data type = 17 is not supported
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…