34 #include <Geometry/Projection.hh>
35 #include <Geometry/ProjectionParametersPerspective.hh>
36 #include <Base/Image/Image.hh>
37 #include <Base/Image/ImageIO.hh>
38 #include <Utils/Param.hh>
39 #include <Utils/IOUtils.hh>
45 int main(
int argc,
char *argv[])
49 string *proj = params.
AddParamString(
"Projection",
"The projection to use, not mandatory",
"",
'p');
50 string *image = params.
AddParamString(
"Image",
"The float (depth) image to use, not mandatory",
"",
'i');
60 ret = projection.
XMLRead(*proj);
61 cout<<
"Loaded projection:"<<*proj<<endl;
63 if(
string(*proj)==
"" || ret < 0){
69 cout<<
"Generated sample projection."<<endl;
75 cout<<
"Loaded image :"<<*image<<endl;
77 if(
string(*image)==
"" || ret < 0){
78 depthImg.
Init(176,144,1);
80 cout<<
"Filled standard image with 5000mm.";
82 if((dynamic_cast<ProjectionParametersPerspective*>(projection.
GetParameters()))!= NULL){
84 TransformCartesianToPolarCoordinates(depthImg, polarDepthImg);
86 cout<<
" ..and transformed to polar."<<endl;
91 if((dynamic_cast<ProjectionParametersPerspective*>(projection.
GetParameters()))!= NULL){
93 TransformPolarToCartesianCoordinates(polarDepthImg, cartDepthImg);
96 TransformCartesianToPolarCoordinates(cartDepthImg,polarDepthImg);
99 cout<<
"Transformed Images."<<endl;
102 BIASERR(
"Not a perspective camera");
int XMLRead(const std::string &Filename)
derived classes must implement the function XMLIn which is called by this function XMLRead to read ev...
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
This class hides the underlying projection model, like projection matrix, spherical camera...
void FillImageWithConstValue(StorageType Value)
fill grey images
static bool ParseCommandLineEvalHelp(Param ¶ms, int argc, char *argv[])
parses the command line, adds parameter "help"
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
void AddAbsoluteCamera(ProjectionParametersBase *ppb)
Add a camera to the projection,the coordinates of the pose are given in absolute Coordinates, they are transformed to relative coordinates to the first camera internally.
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.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
virtual void ValidatePose()
Validate currently set pose.
void SetFocalLengthAndAspect(double f, double AspectRatio)
Set the current camera focal length in pixel and the a spect ratio.
void SetSimplePerspective(const double FoV=M_PI/2, const unsigned int width=512, const unsigned int height=512)
Sets the parameters for a simple perspective camera with imagesize 512x512, focal length 512 (fov = 9...
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)