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

Problem with GCP patch extraction on SPOT 2 scene #28

Open
MatteaE opened this issue Nov 20, 2024 · 1 comment
Open

Problem with GCP patch extraction on SPOT 2 scene #28

MatteaE opened this issue Nov 20, 2024 · 1 comment

Comments

@MatteaE
Copy link

MatteaE commented Nov 20, 2024

I am trying to orthorectify a SPOT 2 scene using a Sentinel-2 reference. I have a set of 50 good tie points computed via image matching with the Ames Stereo Pipeline.
While doing RSM refinement (cGCPOptimization), in some cases some of the GCP patches computed for the raw image include spurious values equal or close to 65535, which squish everything else to black (see attachments - the white specks) and disrupt the correlation, so that model refinement fails (large coregistration error of several pixels, not improving with any iteration).

The SPOT scene is a bit special compared to others, in that it has an inaccurate initial geotransform (off by ~60 km) and its original data type is Float32 instead of UInt8.

I have already tested the following, with no success:

  • converting the SPOT scene to UInt8, with various rescaling/combinations for the NA flag value
  • enlarging the extent of the reference orthoimage and DEM to provide a large margin on all sides
  • changing the extent of the SPOT scene (correcting the GCPs in the GeoTiff image and also the GCPs and location model in the METADATA.DIM file - but not the XYZ satellite location)
  • different versions of geoCosiCorr3D (the old dd4b7a6 and the current c531c22).

Code and data to reproduce are here: https://drive.switch.ch/index.php/s/LsrfwhvJe0YZHfg

Run with
$ python cosicorr_refinement.py Spot2 10 1993-09-20_06-34-29 007-009_S2_187-270-0_1993-09-20-06-34-29_HRV-2_P_DT_RR 1993-09-20_06-34-29/ref_ortho.tif 1993-09-20_06-34-29/ref_dem.tif 1993-09-20_06-34-29/tps_final.txt

I am on Kubuntu 22.04, gdal 3.6.4, pyproj 3.6.1, geopandas 0.14.3, rasterio 1.3.9.

0c3286fd-d641-4fcf-85a6-a045c22e93a9_loop_5
3b1509fe-37b5-44f6-b53b-62b442efb67f_loop_7
3b1509fe-37b5-44f6-b53b-62b442efb67f_loop_8

@MatteaE
Copy link
Author

MatteaE commented Nov 20, 2024

Update: pixel values of around 65535 appear in the GCP patches at locations where the original raw scene has the lowest values (mostly around and below 1, but sometimes as high as 10). The problem could then be an overflow (due to resampling?) somewhere in the production of the GCP patch. For the moment a workaround is to rescale the input raw scene (still saved as Float32 data type) so that no value is dangerously close to 0 - I have found that rescaling from [0,255] to [30,254] appears to provide a safe margin.

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

1 participant