Some General queries to Save an Image after resizing and best way to read the image so that it takes lowest memory.
Having a grayscale image of Lungs/TB in some high resolution say width * height I have resized(downsample) it to a new resolution say new_width * new_height using Image.Antialias format as its the best among others that are (Nearest_neighbour, Bilinear etc) to downsample for segmentation purpose.
Query#1
What's the best Image formats (jpeg, jpg, png) should I save the downsampled/resized image as they are based on some compressions e.g. lossless is used for jpeg, so that minimum amount of loss is entertained.
Query#2
Let us suppose that we saved the resized_image (300*300) in a png format. Its actual size 81kb. But when I am going to read this image as np.array using PIL it gives me a size of 360112 in float32 format and 720112 in float64 format.
from PIL import Image
from sys import getsizeof
img=np.asarray(Image.open(path),dtype=('float32'))/255.0
getsizeof(img) # 360112bytes
Should this also not supposed to be 81kb. Same is the case for cv2.imread.
Query#3
What's the best way to read the image as a numpy array so that it takes the lowest memory.
wrong. jpg is lossy, so avoid that and use png instead.
hmmm, but how is any of it related to opencv ?