首页 > 解决方案 > cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/resize.cpp:3555: 错误: (-215:Assertion failed) func != 0 && cn <= 4 in function'resize'

问题描述

我正在尝试使用 cv2.resize 调整 (720,1280,3) 数组的大小,

data['motion_vector'] = cv2.resize(data['motion_vector'], (int(feat_shape[0][3]), int(feat_shape[0][2])), interpolation = cv2.INTER_AREA)

但我遇到了这样的错误:

Traceback (most recent call last):
  File "experiments/mvff_rfcn/mvff_rfcn_end2end_train_test.py", line 20, in <module>
    train_end2end.main()
  File "experiments/mvff_rfcn/../../mvff_rfcn/train_end2end.py", line 213, in main
    config.TRAIN.lr_step
  File "experiments/mvff_rfcn/../../mvff_rfcn/train_end2end.py", line 101, in train_net
    bbox_std=config.network.ANCHOR_STDS
  File "experiments/mvff_rfcn/../../mvff_rfcn/core/loader.py", line 265, in __init__
    self.get_batch_individual()
  File "experiments/mvff_rfcn/../../mvff_rfcn/core/loader.py", line 414, in get_batch_individual
    rst.append(self.parfetch(iroidb))
  File "experiments/mvff_rfcn/../../mvff_rfcn/core/loader.py", line 438, in parfetch
    data['motion_vector'] = cv2.resize(data['motion_vector'], (int(feat_shape[0][3]), int(feat_shape[0][2])), interpolation = cv2.INTER_AREA)
cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/resize.cpp:3555: error: (-215:Assertion failed) func != 0 && cn <= 4 in function 'resize'

标签: python-2.7resizeopencv4

解决方案


推荐阅读