在使用python imgaug的 augment_images 进行图像增强时,报出如下错误。

File “D:\Anaconda3\lib\site-packages\imgaug\​​imgaug.py​​​”, line 1078, in imresize_many_images
result_img = cv2.resize(images[img_idx], (width, height), interpolation=ip)
cv2.error: OpenCV(3.4.2) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3922: error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize’

resize.cpp:3922: error: (-215:Assertion failed) func != 0 in function


报错位置为opencv-python。后发现是数据类型错误,应(将int32)改为uint8。部分代码如下:

imgs = self.data[pos_start:pos_end, 1:].reshape(-1,self.size,self.size,3).astype(np.uint8)
imgs = seq.augment_images(imgs)