OpenCV调整Python大小

时间:2019-05-20 00:19:31

标签: python opencv

文件夹中有80张图像。他们的名字喜欢; '1.jpg''2.jpg'... '80 .jpg'。

我想调整图像大小,但是有错误;

            for training_name in train_labels:
                # join the training data path and each species training folder
                dir = os.path.join(train_path, training_name)

                current_label = training_name

                k = 1
                for x in range(1,images_per_class+1):
                    file = dir + "/" + str(x) + ".jpg"

                    image = cv2.imread(file)
                    image = cv2.resize(image, fixed_size)


                    fv_hu_moments = fd_hu_moments(image)
                    fv_haralick   = fd_haralick(image)
                    fv_histogram  = fd_histogram(image)


                    global_feature = np.hstack([fv_histogram, fv_haralick, fv_hu_moments])

                    labels.append(current_label)
                    global_features.append(global_feature)

                    i += 1
                    k += 1
                j += 1
  

C:\ projects \ opencv-python \ opencv \ modules \ imgproc \ src \ resize.cpp:4044:错误:(-215:断言失败)!ssize.empty()在函数'cv :: resize'中/ p>

0 个答案:

没有答案