OrthoRectification outputs.default only partially sets default pixels
Description
When I execute orthorectification using outputs.default = 10000.0, part of the no-input pixels will have the value 10000.0 and the other part will have value 0.
The following image uses S1B_IW_GRDH_1SDV_20210517T054123_20210517T054148_026940_0337F2_2CE0 as input, everything inside the red square is the output. The white area has value 10000.0 while the black area has value 0:
It does this while the input values for both sections are identical:
I expect all areas that do not have input data to have the provided default pixel value (=10000.0).
Steps to reproduce
def main():
extent = {
"xmin": 717126.5217391292098910,
"ymin": 5856238.7826086897403002,
"xmax": 733543.9130434772232547,
"ymax": 5869595.3043478215113282,
}
input_tiff = pathlib.Path(
"s1_grd/S1B_IW_GRDH_1SDV_20210517T054123_20210517T054148_026940_0337F2_2CE0.SAFE/measurement/s1b-iw-grd-vh-20210517t054123-20210517t054148-026940-0337f2-002.tiff"
)
import otbApplication as otb
sar_calibration = otb.Registry.CreateApplication('SARCalibration')
sar_calibration.SetParameterString("in", str(input_tiff))
sar_calibration.SetParameterString("lut", "gamma")
ortho_rect = otb.Registry.CreateApplication('OrthoRectification')
ortho_rect.ConnectImage("io.in", sar_calibration, "out")
ortho_rect.SetParameterInt("outputs.sizex", int((extent["xmax"] - extent["xmin"]) / 10))
ortho_rect.SetParameterInt("outputs.sizey", int((extent["ymax"] - extent["ymin"]) / 10))
ortho_rect.SetParameterInt("outputs.ulx", int(extent["xmin"]))
ortho_rect.SetParameterInt("outputs.uly", int(extent["ymax"]))
ortho_rect.SetParameterFloat("outputs.default", 10000.0)
ortho_rect.SetParameterString("io.out", "outputs_default_10000.tif")
ortho_rect.ExecuteAndWriteOutput()
Output:
2023-02-14 14:50:47 (INFO) OrthoRectification: Default RAM limit for OTB is 256 MB
2023-02-14 14:50:47 (INFO) OrthoRectification: GDAL maximum cache size is 779 MB
2023-02-14 14:50:47 (INFO) OrthoRectification: OTB will use at most 8 threads
2023-02-14 14:50:47 (INFO): Loading metadata from official product
2023-02-14 14:50:47 (INFO) OrthoRectification: Elevation management: setting default height above ellipsoid to 0 meters
2023-02-14 14:50:47 (INFO) OrthoRectification: Generating output with size = [1641, 1335]
2023-02-14 14:50:47 (INFO) OrthoRectification: Generating output with pixel spacing = [10.0169, -10.0169]
2023-02-14 14:50:47 (INFO) OrthoRectification: Generating output with origin = [717131, 5.86959e+06]
2023-02-14 14:50:47 (INFO) OrthoRectification: Area outside input image bounds will have a pixel value of [10000]
2023-02-14 14:50:47 (INFO) OrthoRectification: Using a deformation grid with a physical spacing of 4
2023-02-14 14:50:47 (INFO) OrthoRectification: Using a deformation grid of size [4109.41, 3343.12]
2023-02-14 14:50:47 (WARNING) OrthoRectification: Spacing of deformation grid should be at least equal to spacing of output image. Otherwise, computation time will be slow, and precision of output will not be better. You shall set opt.gridspacing appropriately. opt.gridspacing units are the same as outputs.spacing units
2023-02-14 14:50:47 (INFO): Estimated memory for full processing: 82.4119MB (avail.: 256 MB), optimal image partitioning: 1 blocks
2023-02-14 14:50:47 (INFO): File outputs_default_10000.tif will be written in 1 blocks of 1641x1335 pixels
Writing outputs_default_10000.tif...: 100% [**************************************************] (15s)
Configuration information
- OS: Ubuntu 20.04.5 LTS
- OTB Version: OTB-8.1.0-Linux64
- Python bindings imported from /opt/otb/OTB-8.1.0-Linux64/lib/python
Edited by JeroenVerstraelen