33 #include <bias_config.h>
35 #ifndef BIAS_HAVE_XML2
36 # error You need XML2 to compile this code. Please enable USE_XML2 and recompile BIAS.
37 #endif // BIAS_HAVE_XML2
40 #include <Image/ProjectionMapping.hh>
41 #include <Geometry/Projection.hh>
42 #include <Geometry/ProjectionParametersPerspective.hh>
43 #include <Geometry/ProjectionParametersSpherical.hh>
44 #include <Base/Image/ImageIO.hh>
45 #include <Base/Image/ImageConvert.hh>
53 int main(
int argc,
char** argv )
56 cout <<
"Usage: ExampleUndistort <image> <projection.xml>"<<endl;
64 string camfile = argv[2];
66 int ret = proj.
XMLRead(camfile);
68 BIASERR(
"Error reading Projection:"<<camfile);
71 else cout<<
"Read source projection:"<<camfile<<endl;
79 BIASERR(
"Example only implemented for perspective cameras.");
86 SetUndistortion(0.0,0.0,0.0,0.0);
93 BIASERR(
"error loading image "<<argv[1]);
97 cout<<
"Converting to RGB:"<<endl;
102 cout<<
"Colormodel is RGB:"<<endl;
117 cout <<
" created: "<<
"UndistortedImage.mip"<<endl;
118 cout <<
" created: "<<
"DisplacementImage.mip"<<endl;
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...
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()
unsigned int GetWidth() const
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
This class hides the underlying projection model, like projection matrix, spherical camera...
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
color values, 3 channels, order: red,green,blue
unsigned int GetHeight() const
int Map(const Image< InputStorageType > &src, Image< OutputStorageType > &sink, InterpolationMethod=MapTrilinear, bool newSink=false, double SuperSampling=1.0)
backward mapping with various interpolations
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 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
enum EColorModel GetColorModel() const
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...
int GetDisplacementMap(Image< float > &dismap, int width, int height)
precomputes lookup coordinates and computes displacement map int TEXTURE coordinates, according to the size of src (or width,height)
static int ToRGB(const Image< StorageType > &source, Image< StorageType > &dest)
Create a RGB converted copy of source image in this.