Commit 8c43bc27 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'fix_orthorectification_projection' into 'develop'

Fix output image from orthorectification having no projection

See merge request !752
parents 9f68fb4e 492432a4
Pipeline #5838 passed with stages
in 46 minutes and 24 seconds
......@@ -107,6 +107,8 @@ void GenericRSResampleImageFilter<TInputImage, TOutputImage>::GenerateOutputInfo
{
itk::EncapsulateMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, this->GetOutputKeywordList());
}
this->GetOutput()->SetProjectionRef(this->GetOutputProjectionRef());
}
/**
......
......@@ -113,10 +113,9 @@ int otbGenericRSResampleImageFilter(int argc, char* argv[])
origin[1] = strtod(argv[4], nullptr); // Origin northing
orthoRectifFilter->SetOutputOrigin(origin);
std::string wkt =
otb::SpatialReference::FromUTM(atoi(argv[9]), atoi(argv[10]) ? otb::SpatialReference::hemisphere::north : otb::SpatialReference::hemisphere::south)
.ToWkt();
orthoRectifFilter->SetOutputProjectionRef(wkt);
auto inputSpatialRef = otb::SpatialReference::FromUTM(atoi(argv[9]), atoi(argv[10]) ? otb::SpatialReference::hemisphere::north : otb::SpatialReference::hemisphere::south);
orthoRectifFilter->SetOutputProjectionRef(inputSpatialRef.ToWkt());
// Displacement Field spacing
VectorImageType::SpacingType gridSpacing;
......@@ -138,5 +137,15 @@ int otbGenericRSResampleImageFilter(int argc, char* argv[])
writer->SetNumberOfDivisionsTiledStreaming(4);
writer->Update();
auto outputProjectionRef = orthoRectifFilter->GetOutput()->GetProjectionRef();
if (outputProjectionRef.empty() ||
otb::SpatialReference::FromDescription(outputProjectionRef) != inputSpatialRef)
{
std::cout << "Input and output projection don't match. "
<< "The output projection is: "
<< outputProjectionRef
<< std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment