25 #include <Image/SphericalRectification.hh>
26 #include <Geometry/ProjectionParametersGreatCircles.hh>
33 #define SUPERPARENT RectificationBase<InputStorageType, OutputStorageType>
34 #define PARENT RectificationViaProjectionMappingBase<InputStorageType, OutputStorageType>
37 template <
class InputStorageType,
class OutputStorageType>
43 template <
class InputStorageType,
class OutputStorageType>
49 template <
class InputStorageType,
class OutputStorageType>
64 template <
class InputStorageType,
class OutputStorageType>
69 Pose poseA = SUPERPARENT::ppBA_->GetPose();
70 Pose poseB = SUPERPARENT::ppBB_->GetPose();
71 Pose rectPoseA, rectPoseB;
72 if(SUPERPARENT::CalculateRectifiedBases(poseA, poseB,
73 rectPoseA, rectPoseB,
false)!=0)
76 delete PARENT::rectPPA_;
77 delete PARENT::rectPPB_;
83 PARENT::rectPPA_->SetPose(rectPoseA);
84 PARENT::rectPPB_->SetPose(rectPoseB);
90 BIASASSERT(ppsA != NULL && ppsB != NULL);
99 double minThetaA, minPhiA, maxThetaA, maxPhiA;
100 if(!ppgcA -> GetAngleInterval(worldOpticalAxisA,
102 minThetaA, maxThetaA,
103 minPhiA, maxPhiA) ) {
104 cerr<<
"phi A = ("<<minPhiA<<
", "<<maxPhiA<<
")\n";
109 double minThetaB, minPhiB, maxThetaB, maxPhiB;
111 if(!ppgcB -> GetAngleInterval(worldOpticalAxisB,
113 minThetaB, maxThetaB,
115 cerr<<
"phi B = ("<<minPhiB<<
", "<<maxPhiB<<
")\n";
125 double commonThetaMin, commonPhiMin, commonThetaMax, commonPhiMax;
126 commonThetaMin = (minThetaA<minThetaB) ? minThetaA : minThetaB;
128 commonPhiMin = (minPhiA>minPhiB) ? minPhiA : minPhiB;
134 if(commonThetaMin<PARENT::thetaMinOverride_)
135 commonThetaMin= PARENT::thetaMinOverride_;
136 if(commonPhiMin<PARENT::phiMinOverride_)
137 commonPhiMin= PARENT::phiMinOverride_;
139 commonThetaMax = (maxThetaA>maxThetaB) ? maxThetaA : maxThetaB;
141 commonPhiMax = (maxPhiA>maxPhiB) ? maxPhiB : maxPhiA;
144 if(commonPhiMax>PARENT::phiMaxOverride_)
145 commonPhiMax = PARENT::phiMaxOverride_;
146 if(commonThetaMax>PARENT::thetaMaxOverride_)
147 commonThetaMax = PARENT::thetaMaxOverride_;
156 double angularSamplingDistancePhi = 1.0/maxRadius;
159 double angularSamplingDistanceThetaA =
161 double angularSamplingDistanceThetaB =
163 double angularSamplingDistanceTheta =
164 (angularSamplingDistanceThetaA < angularSamplingDistanceThetaB) ?
165 angularSamplingDistanceThetaA : angularSamplingDistanceThetaB;
168 double minAngularSamplingDistance =
169 (angularSamplingDistancePhi<angularSamplingDistanceTheta) ?
170 angularSamplingDistancePhi : angularSamplingDistanceTheta ;
173 double angleRangeTheta = commonThetaMax - commonThetaMin;
174 double angleRangePhi = commonPhiMax - commonPhiMin;
175 double numSamplesOnEpiLine = angleRangeTheta/minAngularSamplingDistance;
176 double numEpiLines = angleRangePhi/minAngularSamplingDistance;
182 commonThetaMin, commonThetaMax,
183 (
unsigned int)floor(numSamplesOnEpiLine),
184 (
unsigned int)floor(numEpiLines));
186 commonThetaMin, commonThetaMax,
187 (
unsigned int)floor(numSamplesOnEpiLine),
188 (
unsigned int)floor(numEpiLines));
216 #if defined(BUILD_IMAGE_CHAR)
221 #if defined(BUILD_IMAGE_USHORT)
225 #if defined(BUILD_IMAGE_SHORT)
229 #if defined(BUILD_IMAGE_SHORT)&&defined(BUILD_IMAGE_USHORT)
233 #if defined(BUILD_IMAGE_INT)
237 #if defined(BUILD_IMAGE_USHORT)
241 #if defined(BUILD_IMAGE_USHORT) && defined(BUILD_IMAGE_INT)
245 #if defined(BUILD_IMAGE_DOUBLE)
void SetInternals(const double minPhi, const double maxPhi, const double minTheta, const double maxTheta, const unsigned int imgWidth, const unsigned int imgHeight)
Calculates and sets internal camera parameters.
Base class for rectification implementations that make use of projections to represent rectified stat...
virtual int DetermineRectificationParameters_()
Calculating the projection parameters for specific rectification.
virtual bool IsInputCameraValid(const BIAS::Image< InputStorageType > &img, const BIAS::ProjectionParametersBase *proj)
only spherical cameras are allowed for now
spherical camera that samples along big circles containig the H vector.
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
Class implements rectification by image projection onto a sphere.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
virtual ~SphericalRectification()
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...