Issue
I would like to know how to read (if it is possible) an image after augmentation by Albumentations
.
I tried:
my_img = 'xyz.jpg'
image = cv2.imread(my_img)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
transformed = transform(image=image)
new_img = np.array(list(transformed.values())
Image.formarray(new_img)
but I get this error:
TypeError: Cannot handle this data type: (1, 1, 512, 3), |u1
Solution
The variable transformed
is a dictionary type. You have to display the value stored in the key image
as an image array.
>>> type(transformed)
<class 'dict'>
# store the value in image key as an array & display it
transformed_image = transformed['image']
cv2.imshow(transformed_image)
Answered By - Jeru Luke
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.