我正在增强数据,之后我使用opencv将增强的图像保存到文件夹中,但它给出了一个错误。
下面的代码我试过了:
aug_dir = '/content/gdrive/MyDrive/augment_images/resized_224'
for i in range(1, 5):
filename = "/content/gdrive/MyDrive/augment_images/{}.jpg".format(i)
img = imaugs.resize(filename, width = 224, height = 224)
#save image
cv2.imwrite("/content/gdrive/MyDrive/augment_images/resized_224/{}.jpg".format(i),img)
错误
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-7-58253ac0f107> in <cell line: 3>()
7
8 #save image
----> 9 cv2.imwrite("/content/gdrive/MyDrive/augment_images/resized_224/{}.jpg".format(i),img)
10
11
error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'imwrite'
> Overload resolution failed:
> - img is not a numpy array, neither a scalar
> - Expected Ptr<cv::UMat> for argument 'img'
我想增强图像保存在一个文件夹使用opencv
1条答案
按热度按时间goqiplq21#