1 year ago

#106411

test-img

Joaquín Bozzalla

Convert 32float SAR image to a grey-scale uint8

I'm working with SAR images from Sentinel-1. I use SNAP library to get images in geotiff format. These geotiff have two layers: one for Intensity_VH and the other for Intensity_VV.

The problem is that the data type of the geotiff is float of 32 bits, and I need it as uint8.

Currently, I'm using rasterio and opencv2 in python to downcast the numpy matrix:

black_white_band = np.add(band1, band2) / 2
image = np.dstack((black_white_band, black_white_band, black_white_band))    
final_image = cv2.normalize(image, None, 0, 255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U)

But the loss of information is too high:

Image with 32 bits float:

Image with 32 bits float

Image with 8 bits int:

Image with 8 bits int

How can I convert two layers of 32 bits float in a grey-scale image of 8 bits? When I use Photoshop to simply open the image and export it as jpg it throw the next result, which is pretty good:

Image with 8 bits int from photoshop

- First update

This is the original image file.

- Second update

I also tried doing an equalization of the histogram. The results are good but the whites are exaggerated: enter image description here

python

opencv

image-processing

satellite-image

0 Answers

Your Answer

Accepted video resources