I am trying to upscale a portion of an image (200 x 200 pixels) with dask_image, into an image of (400 x 400) pixels. See the result in the picture.
The tile (400 x 400 pixels) that I obtain is blurry, even if the queried region below is smaller. I am using the following code:
kwargs = {"prefilter": False, "order": 0}
# tried also these, and other combinations
# kwargs = {"prefilter": True}
# kwargs = {}
# resample the image
transformed_dask = dask_image.ndinterp.affine_transform(
xdata.data,
matrix=matrix,
output_shape=output_shape,
**kwargs,
)
Is there a way to get a sharper result? Intuitively I would expect that if I resample an image of low res into a higher res one, I should not get an image blurrier quality.
The use case I have is generating tiles for deep learning, in which I am making the query in natural coordinates (micrometers) and I am getting tiles of the desired size in pixels. At the moment, because of the described behavior, I can get sharp images only if the micrometers that I query, converted in pixels, correspond exactly to the pixel size of the tile that I ask for, which is not the general case.