Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird results when producing a HR image #59

Open
Topping1 opened this issue Jan 18, 2023 · 5 comments
Open

Weird results when producing a HR image #59

Topping1 opened this issue Jan 18, 2023 · 5 comments

Comments

@Topping1
Copy link

I am using sr4rs version 1.3 and otbtf version 3.3.3-gpu on ubuntu 22.04 (GPU is Quadro P1000). I have downloaded 4 bands of an image (B4,B3,B2,B8) from Sentinel-2 using the site EO Browser. I have installed sr4rs using the instructions provided and concatenated the images using otbcli_ConcatenateImages. When I run the program, I get results like the following image:

image

do you know what might be causing this issue? I can provide more information if needed.

@remicres
Copy link
Owner

Hi @Topping1 ,

This reminds me a similar issue where an user has reported such strange result, but I didn't have enough info at the time.

In order to solve this, could you try to:

  • zoom at pixel resolution (such as 1 pixel of your screen = 1 pixel of the image) and share a screenshot
  • post the result of gdalinfo -stats $your_img here
  • create a small subset of you input image, and share it? e.g. otbcli_ExtractROI -in $your_img -startx 4000 -starty 4000 -sizex 500 -sizey 500 -out "output.tif?&gdal:COMPRESS=DEFLATE" int16 so I can run some analysis?

thanks

@Topping1
Copy link
Author

Thanks for your quick response.

-The image at pixel resolution is below:
image

-the result of gdalinfo -stats is below:

Driver: GTiff/GeoTIFF
Files: merge-4326.tif
merge-4326.tif.aux.xml
Size is 459, 233
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-78.656294345999996,-6.753707714000000)
Pixel Size = (0.000089757583878,-0.000089531502146)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( -78.6562943, -6.7537077) ( 78d39'22.66"W, 6d45'13.35"S)
Lower Left ( -78.6562943, -6.7745686) ( 78d39'22.66"W, 6d46'28.45"S)
Upper Right ( -78.6150956, -6.7537077) ( 78d36'54.34"W, 6d45'13.35"S)
Lower Right ( -78.6150956, -6.7745686) ( 78d36'54.34"W, 6d46'28.45"S)
Center ( -78.6356950, -6.7641381) ( 78d38' 8.50"W, 6d45'50.90"S)
Band 1 Block=459x1 Type=Float32, ColorInterp=Gray
Min=0.015 Max=0.964 
Minimum=0.015, Maximum=0.964, Mean=0.119, StdDev=0.079
Metadata:
STATISTICS_MAXIMUM=0.96410000324249
STATISTICS_MEAN=0.118685167457
STATISTICS_MINIMUM=0.015100000426173
STATISTICS_STDDEV=0.078870281782
STATISTICS_VALID_PERCENT=100
Band 2 Block=459x1 Type=Float32, ColorInterp=Undefined
Min=0.009 Max=1.002 
Minimum=0.009, Maximum=1.002, Mean=0.120, StdDev=0.073
Metadata:
STATISTICS_MAXIMUM=1.0017999410629
STATISTICS_MEAN=0.12008681779008
STATISTICS_MINIMUM=0.0091000003740191
STATISTICS_STDDEV=0.072611022876824
STATISTICS_VALID_PERCENT=100
Band 3 Block=459x1 Type=Float32, ColorInterp=Undefined
Min=0.000 Max=0.974 
Minimum=0.000, Maximum=0.974, Mean=0.093, StdDev=0.072
Metadata:
STATISTICS_MAXIMUM=0.97399997711182
STATISTICS_MEAN=0.0925235285364
STATISTICS_MINIMUM=0.00039999998989515
STATISTICS_STDDEV=0.071719903379566
STATISTICS_VALID_PERCENT=100
Band 4 Block=459x1 Type=Float32, ColorInterp=Undefined
Minimum=0.004, Maximum=0.982, Mean=0.236, StdDev=0.095
Metadata:
STATISTICS_MAXIMUM=0.9815000295639
STATISTICS_MEAN=0.23577339054692
STATISTICS_MINIMUM=0.0041000000201166
STATISTICS_STDDEV=0.0947568401415
STATISTICS_VALID_PERCENT=100

-the area that I want to process is quite small, so I am including the entire image (and the bands as downloaded from EO browser) in the Zip file below:

image.zip

thanks for you help!

@remicres
Copy link
Owner

remicres commented Jan 18, 2023

Thanks, the problem comes from the input image, there is no doubt.
The input image pixel values ranges and [0, 1] which is very different from the Sentinel-2 level 2A (integer, 16 bits). I don't know what processing the provider made, but it clearly has changed the image values.
The pre-trained network is suited for the original, level 2A, 16 bits images.
Maybe they just have applied another radiometric correction, and keep the resulting value as float. In this case you could try to multiply the input image with a factor (1000? or better, the correct factor).
What you can do is download the same S2 image from the microsoft planetary computer (e.g. using the QGIS STAC plugin), and compare the values.

@Topping1
Copy link
Author

Merci beaucoup! I will try your suggestions and report back the results.

@Topping1
Copy link
Author

It worked, it seems that I downloaded the files from EO Browser using a 32 bit format (EO Browser offers 16 bit and 32 bit formats). Once I downloaded again as 16 bit, everything worked correctly. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants