Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
73c5a087
Commit
73c5a087
authored
13 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Homogeneous trigonometry
parent
06f7a2ad
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx
+17
-26
17 additions, 26 deletions
...arityMap/otbStereorectificationDeformationFieldSource.txx
with
17 additions
and
26 deletions
Code/DisparityMap/otbStereorectificationDeformationFieldSource.txx
+
17
−
26
View file @
73c5a087
...
...
@@ -212,22 +212,14 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// Now, we can compute the origin of the epipolar images in the left
// input image geometry (we rotate back)
itk::ContinuousIndex<double,2> outputOriginCIndexInLeftImage;
outputOriginCIndexInLeftImage[0] = leftInputOrigin[0] + ux * minx + vx * miny;
outputOriginCIndexInLeftImage[1] = leftInputOrigin[1] + uy * minx + vy * miny;
PointType tmpPointForConversion;
m_LeftImage->TransformContinuousIndexToPhysicalPoint(outputOriginCIndexInLeftImage, tmpPointForConversion);
m_OutputOriginInLeftImage[0] = tmpPointForConversion[0];
m_OutputOriginInLeftImage[1] = tmpPointForConversion[1];
m_OutputOriginInLeftImage[0] = leftInputOrigin[0] + m_LeftImage->GetSpacing()[0] * (ux * minx + vx * miny);
m_OutputOriginInLeftImage[1] = leftInputOrigin[1] + m_LeftImage->GetSpacing()[0] * (uy * minx + vy * miny);
m_OutputOriginInLeftImage[2] = m_AverageElevation;
// And also the size of the deformation field
SizeType outputSize;
outputSize[0] = (m_RectifiedImageSize[0] / m_GridStep
)
+ 1;
outputSize[1] = (m_RectifiedImageSize[1] / m_GridStep
)
+ 1;
outputSize[0] = (m_RectifiedImageSize[0] / m_GridStep + 1
)
;
outputSize[1] = (m_RectifiedImageSize[1] / m_GridStep + 1
)
;
// Build the output largest region
RegionType outputLargestRegion;
...
...
@@ -268,7 +260,7 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// Retrieve the output pointers
OutputImageType * leftDFPtr = this->GetLeftDeformationFieldOutput();
OutputImageType * rightDFPtr = this->Get
Lef
tDeformationFieldOutput();
OutputImageType * rightDFPtr = this->Get
Righ
tDeformationFieldOutput();
// Declare all the TDPoint variables we will need
TDPointType currentPoint1, currentPoint2,nextLineStart1,nextLineStart2, startLine1, endLine1, startLine2, endLine2, epiPoint1, epiPoint2;
...
...
@@ -285,8 +277,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// We define the iterators we will use
typedef itk::ImageRegionIteratorWithIndex<OutputImageType> IteratorType;
IteratorType it1(leftDFPtr,leftDFPtr->Get
Buffered
Region());
IteratorType it2(rightDFPtr,rightDFPtr->Get
Buffered
Region());
IteratorType it1(leftDFPtr,leftDFPtr->Get
LargestPossible
Region());
IteratorType it2(rightDFPtr,rightDFPtr->Get
LargestPossible
Region());
it1.GoToBegin();
it2.GoToBegin();
...
...
@@ -295,7 +287,7 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
m_MeanBaselineRatio = 0;
// Set-up progress reporting
itk::ProgressReporter progress(this, 0, leftDFPtr->Get
Buffered
Region().GetNumberOfPixels());
itk::ProgressReporter progress(this, 0, leftDFPtr->Get
LargestPossible
Region().GetNumberOfPixels());
// We loop on the deformation fields
...
...
@@ -337,17 +329,17 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// This point is the image of the left input image origin at the
// average elevation
currentPoint1[2] = m_AverageElevation;
epiPoint2 = m_
RightToLef
tTransform->TransformPoint(currentPoint1);
epiPoint2 = m_
LeftToRigh
tTransform->TransformPoint(currentPoint1);
// The begining of the epipolar line in the left image is the image
// of epiPoint2 at a lower elevation (using the offset)
epiPoint2[2] = m_AverageElevation - m_ElevationOffset;
startLine1 = m_
LeftToRigh
tTransform->TransformPoint(epiPoint2);
startLine1 = m_
RightToLef
tTransform->TransformPoint(epiPoint2);
// The endning of the epipolar line in the left image is the image
// of epiPoint2 at a higher elevation (using the offset)
epiPoint2[2] = m_AverageElevation + m_ElevationOffset;
endLine1 = m_
LeftToRigh
tTransform->TransformPoint(epiPoint2);
endLine1 = m_
RightToLef
tTransform->TransformPoint(epiPoint2);
// Estimate the local baseline ratio
double localBaselineRatio = ((endLine1[0] - startLine1[0])
...
...
@@ -383,8 +375,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// We want to move m_Scale pixels away in the epipolar line of the
// first image
// TODO: Take into account height direction ?
double alpha1 = vcl_atan(a1);
double deltax1 =
-
m_Scale * m_GridStep * vcl_cos(alpha1);
double alpha1 =
M_PI -
vcl_atan(a1);
double deltax1 =
m_Scale * m_GridStep * vcl_cos(alpha1);
double deltay1 = -m_Scale * m_GridStep * vcl_sin(alpha1);
// Before moving currentPoint1, we will store its image by the
...
...
@@ -408,8 +400,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
// Now, we compute the displacement in right image. The iscale
// factor already account for m_GridStep and scale, no need to use
// them again
double alpha2 = vcl_atan(a2);
double deltax2 =
-
iscale * vcl_cos(alpha2);
double alpha2 =
M_PI -
vcl_atan(a2);
double deltax2 =
iscale * vcl_cos(alpha2);
double deltay2 = - iscale * vcl_sin(alpha2);
// We can now move currentPoint2
...
...
@@ -424,9 +416,8 @@ StereorectificationDeformationFieldSource<TInputImage, TOutputImage>
{
// We want to move 1 pixel away in the direction orthogonal to
// epipolar line
double beta1 = M_PI/2 + alpha2;
double nextdeltax1 = -m_Scale * m_GridStep * vcl_cos(beta1);
double nextdeltay1 = -m_Scale * m_GridStep * vcl_sin(beta1);
double nextdeltax1 = m_Scale * m_GridStep * vcl_sin(alpha1);
double nextdeltay1 = m_Scale * m_GridStep * vcl_cos(alpha1);
// We can then update nextLineStart1
nextLineStart1[0] = currentPoint1[0] - deltax1 + nextdeltax1;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment