diff --git a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx index f84f022d0fd32a9c358f948fc1e608db66d8b677..6831d6db1776712f1d9e4a2f94a076b2a7d4e03f 100644 --- a/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx +++ b/Applications/DisparityMap/otbStereoRectificationGridGenerator.cxx @@ -252,6 +252,8 @@ private: m_DEMToImageGenerator->SetOutputSpacing(spacing); m_DEMToImageGenerator->SetOutputProjectionRef(GetParameterImage("io.inleft")->GetProjectionRef()); m_DEMToImageGenerator->SetOutputKeywordList(GetParameterImage("io.inleft")->GetImageKeywordlist()); + // 0 by default + m_DEMToImageGenerator->SetDefaultUnknownValue(0); m_DEMToImageGenerator->AboveEllipsoidOn(); diff --git a/Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx b/Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx index 1700ffc5e3dfbd220f37b7bd16aad1a562d1b265..8b490b7818f5304a721ad8ae2df3baafdd111406 100644 --- a/Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx +++ b/Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx @@ -172,6 +172,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage> // First, spacing SpacingType outputSpacing; outputSpacing.Fill(m_Scale * m_GridStep); + outputSpacing[0]*=m_LeftImage->GetSpacing()[0]; + outputSpacing[1]*=m_LeftImage->GetSpacing()[1]; // Then, we retrieve the origin of the left input image double localElevation = m_AverageElevation; @@ -459,8 +461,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage> // first image // TODO: Take into account height direction ? double alpha1 = otb::CONST_PI - vcl_atan(a1); - double deltax1 = m_Scale * m_GridStep * vcl_cos(alpha1); - double deltay1 = -m_Scale * m_GridStep * vcl_sin(alpha1); + double deltax1 = m_Scale * m_GridStep * m_LeftImage->GetSpacing()[0] * vcl_cos(alpha1); + double deltay1 = -m_Scale * m_GridStep * m_LeftImage->GetSpacing()[1] * vcl_sin(alpha1); // Before moving currentPoint1, we will store its image by the // left to right transform at the m_AverageElevation, to compute @@ -500,8 +502,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage> { // We want to move 1 pixel away in the direction orthogonal to // epipolar line - double nextdeltax1 = m_Scale * m_GridStep * vcl_sin(alpha1); - double nextdeltay1 = m_Scale * m_GridStep * vcl_cos(alpha1); + double nextdeltax1 = m_Scale * m_LeftImage->GetSpacing()[0] * m_GridStep * vcl_sin(alpha1); + double nextdeltay1 = m_Scale * m_LeftImage->GetSpacing()[1] *m_GridStep * vcl_cos(alpha1); // We can then update nextLineStart1 nextLineStart1[0] = currentPoint1[0] - deltax1 + nextdeltax1;