33 #include <Base/Image/ImageIO.hh>
34 #include <Image/Camera.hh>
35 #include <Image/PlanarRectification.hh>
36 #include <Image/RectificationBase.hh>
37 #include <Utils/Param.hh>
38 #include <Utils/IOUtils.hh>
44 int main(
int argc,
char* argv[])
57 if(!IOUtils::ParseCommandLineEvalHelp(params, argc, argv))
62 if(!IOUtils::LoadCamera<unsigned char>(leftCamName, camLeft, projLeft))
64 if(!IOUtils::LoadCamera<unsigned char>(centerCamName, camCenter, projCenter))
66 if(!IOUtils::LoadCamera<unsigned char>(rightCamName, camRight, projRight))
85 sphericalBase.
Set(orientation, poseCenter.
GetC());
89 double minPhi, maxPhi, centerPhi, minTheta, maxTheta;
90 cerr<<
"sphericalBase "<<sphericalBase.
GetR()<<endl;
91 cerr<<
"CameraBase "<<projCenter.
GetR()<<endl;
96 cerr<<
"minPhi "<<minPhi<<
", maxPhi "<<maxPhi<<endl;
97 cerr<<
"centerPhi "<<centerPhi<<endl;
98 cerr<<
"minTheta "<<minTheta<<
", maxTheta "<<maxTheta<<endl;
100 double minSamplingStep;
111 2.0*minSamplingStep);
114 rectPPPLeft=rectPPPRight=rectPPPCenter;
117 rectPPPLeft.
SetQ(orientation);
118 rectPPPCenter.
SetC(poseCenter.
GetC());
119 rectPPPCenter.
SetQ(orientation);
120 rectPPPRight.
SetC(poseRight.
GetC());
121 rectPPPRight.
SetQ(orientation);
122 cerr<<
"rectPPPC = "<<rectPPPCenter<<endl;
123 cerr<<
"rectPPPLeft = "<<rectPPPLeft<<endl;
124 cerr<<
"rectPPPRight = "<<rectPPPRight<<endl;
127 rectifierCenter, rectifierRight;
129 unsigned int targetWidth, targetHeight;
131 cerr<<targetWidth<<
"x"<< targetHeight<<endl;
134 rectCamLeft.
Init(targetWidth, targetHeight,3);
135 rectCamRight.
Init(targetWidth, targetHeight,3);
136 rectCamCenter.
Init(targetWidth, targetHeight,3);
154 rectifierCenter.
Map(camCenter, rectCamCenter);
155 IOUtils::SaveCamera<unsigned char>(
"centerRect.mip",
158 rectifierCenter.
Map(camLeft, rectCamLeft);
159 IOUtils::SaveCamera<unsigned char>(
"leftRect.mip",
163 rectifierCenter.
Map(camRight, rectCamRight);
164 IOUtils::SaveCamera<unsigned char>(
"righRect.mip",
int SetIntrinsics(double minPhi, double maxPhi, double minTheta, double maxTheta, double angleStep, double aspectratio=1.0)
Method calculates K-Matrix and image size from specified angles.
virtual const Pose & GetPose(unsigned int cam=0) const
return complete pose object.
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
void SetSinkCam(const Projection &P, const Image< float > *sinkdepth=NULL)
Set your sink projection before calling Map(),.
void SetSourceCam(const Projection &P)
Set your source projection before calling Map()
virtual int GetSphericalViewingRange(const CoordinateTransform3D &sphericalReferenceFrame, double &minPhi, double &maxPhi, double ¢erPhi, double &minTheta, double &maxTheta)
Determines the maximal and minimal viewing range in means of spherical coordinates.
base class for rectification implementations and wrappers
virtual void SetQ(const BIAS::Quaternion< double > &Q)
Set orientation from unit quaternion Q.
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
This class hides the underlying projection model, like projection matrix, spherical camera...
int Map(const Image< InputStorageType > &src, Image< OutputStorageType > &sink, InterpolationMethod=MapTrilinear, bool newSink=false, double SuperSampling=1.0)
backward mapping with various interpolations
int GetFreeGroupID()
returns unused group id
int PrepareLookupTableMapping(const Image< InputStorageType > &src, Image< OutputStorageType > &sink, InterpolationMethod method, bool newSink=false)
precomputes lookup coordinates for accessing src
virtual int GetImageSize(unsigned int &Width, unsigned int &Height) const
Obtain image dimensions.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
This class Param provides generic support for parameters.
int SetGroupName(const int group_id, const std::string &name)
sets the name for a group
virtual int GetMinimalAngularSamplingStep(double &minAngleStep)
Delivers the assumed minimal angular distance between two optical rays belonging to integer image coo...
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
virtual void SetC(const BIAS::Vector3< double > &C)
Set projection center.
RMatrix GetR(unsigned int cam=0) const
return RMatrix of camera with index cam.