Plot_image factor


i’m new to sentinelhub API and I would like to ask question regard the script in the documentation.

when I plot image it has variable of factor ,e.g:

image = true_color_imgs[0]
print(f'Image type: {image.dtype}')

# plot function
# factor 1/255 to scale between 0-1
# factor 3.5 to increase brightness
plot_image(image, factor=3.5/255, clip_range=(0,1))


Why do we have this part? what does it do?



The image that you are returning is in UINT8 (integer values from 0 to 255). To plot the bands as a true-colour image, the function reads values from 0 to 1. So, to convert the range from 0-255 to 0-1 you divide your values by 255.
However, by plotting the entire range of values, the images often appear quite dark (vegetation, soil, water etc. have a low reflectance). To improve the image and make it “brighter” you can multiply it by a factor, here (3.5).

Of course, you can adjust this to suit your needs.

1 Like