I am using the image.scale() function in my code as follows:
img.scale(x_scale=SCALE, roi=[40,0,height,height], hint=image.AREA)
with height being the original max size of 240
my attempt is to crop the image to 240x240 and downsize it with area interpolation for maximum quality.
the result is a 47x47 pixels image.
Sadly if I compare it to the same sized image that i preprocessed in python on my computer, where i also used area interpolation with the opencv library, the quality of my arduino preprocessed image differs a lot from the one preprocessed on my laptop with python.
For reference, the images i am preprocessing are both taken with the Nicla Vision Camera, therefore originally the same resolution.
Is there a way to further improve the quality of the downsized image?
Hi, can you post both output images and the source image.
We use a fractional area scaling algorithm to downscale an image that’s not a multiple of the image size. It should produce pretty decent images. 47x47 pixels though doesn’t really leave a lot of room for quality though in general.
As comparison this is the image i got with the same preprocessing strategy in python with the cv2 library:
At the same time the files also differ in memory size, which seems legit when looking at the quality.
Hi, from the looks of it our scaling algorithm does exactly what is requested.
The comparison image you posted is from a different source image (the gauge dial and lighting are different).
Regarding the file size, you need to save the image as a bmp file, not jpeg. The files should be the same size then and you can fairly compare the quality.