Reputation: 693
I was trying to resize the input image using OpenCV but I am having problems converting the resized np array into the original format.
image = imageio.imread(filename) #<class 'imageio.core.util.Image'>
image_re = cv2.resize(image, (256, 256)) #<class 'numpy.ndarray'>
#convert into <class 'imageio.core.util.Image'> here
Thanks in advance.
Upvotes: 4
Views: 7765
Reputation: 1201
imageio.core.util.Image
is just a subclass of np.ndarray
with a meta attribute. Why do you want to go back to it?
Some further explanation of your objectives would probably help clarify the question.
Upvotes: 5
Reputation: 635
use the following code
width = height = 256
dim = (width, height)
file_name = "your file address here"
image = imageio.imread(file_name )
resized = cv2.resize(image, dim, interpolation = cv2.INTER_AREA)
image2 = imageio.core.util.Array(resized)
what you need to use is image2
Upvotes: 0