我正在尝试从文件中读取图像,但它给了我这个错误 - cv2.error:OpenCV(4.0.0) C:\项目\的OpenCV-蟒\的OpenCV \模块\ imgproc \ SRC \ color.cpp:181: 错误:( - 215:断言失败)……
这对我有用。尝试:
def create_imageset(excludeHardClasses=True): #Variables images_path = "C:\Users\bipin\Anaconda3\ASLConvNet-master\src\images\\" #Read for images folder image_files = [f for f in listdir(images_path) if isfile("".join(images_path, f))] #processing and reading image files image_set = [] #contains all images for i in image_files : #split info = i.split('_') if excludeHardClasses and info[1] in exclude_label_list: continue if info[1] == 'o': info[1] = '0' if info[1] == 'v': info[1] = '2' matrix = cv2.imread(images_path + '\\' + i) RGB_img = cv2.cvtColor(matrix, cv2.COLOR_BGR2RGB)