26 #include <Base/Image/ImageIO.hh>
27 #include <Image/Camera.hh>
28 #include <Image/PlanarRectification.hh>
29 #include <Image/CylindricalRectification.hh>
30 #include <Image/SphericalRectification.hh>
31 #include <Image/RectificationBase.hh>
32 #include <Utils/Param.hh>
33 #include <Utils/ThreeDOut.hh>
34 #include <Base/Image/ImageConvert.hh>
40 #define OutStorageType unsigned char
59 const double* zeroParallaxZ,
ROI& roiA,
ROI& roiB,
60 bool verbose =
false);
65 double CalculateRescaleFactor(
int targetWidth,
int targetHeight,
int roiWidth,
68 void CentralCropRoi(
int targetWidth,
int targetHeight,
ROI& roi);
71 int main(
int argc,
char* argv[]) {
76 bool* help = params.
AddParamBool(
"help",
"",
false,
'h', groupID);
82 "write out vrml with rect geometry",
false, 0, groupID);
84 "dont use texture,but colored vertices",
false, 0, groupID);
90 cylindrical = 0, spherical, planar, planarKeepAspect
92 vector<string> rectificationTypes;
93 rectificationTypes.push_back(
"cylindrical");
94 rectificationTypes.push_back(
"spherical");
95 rectificationTypes.push_back(
"planar");
96 rectificationTypes.push_back(
"planarKeepAspect");
98 "what kind of rectification shall be performed?:"
99 " [cylindrical], spherical, planar, planarKeepAspect",
100 rectificationTypes, 0, NULL, 0, groupID);
105 vector<string> interpolationType;
106 interpolationType.push_back(
"Trilinear");
107 interpolationType.push_back(
"Bilinear");
109 "what kind of interpolation shall be performed?:"
110 " [Trilinear], Bilinear", interpolationType, 0, NULL, 0,
114 "scales the resolution of rectified images", 0.8, 0.001, DBL_MAX,
118 "turn off the use of look up tables",
false, 0, groupID);
139 "Give the resolution of the fully filled rectangle in the rectified images, "
140 "that shall be possible to crop."
141 " If both components are negative, this feature is disabled, using the rescale parameter."
142 " If one component is above 0 the parameter rescale is not used.",
143 "-1 -1", 0, groupID);
146 "if target resolution is given, crop resulting images to these values. "
147 "Delivers the cropped results as output.",
false, 0, groupID);
153 "give the zero parallax z-distance in rectified space. "
154 "From this the cropping and rescale parameters can be adapted. "
155 "A value below zero indicates infinity! Only works with planar rectification.",
156 -1, -1, DBL_MAX, 0, groupID);
159 * cropInformationFile =
162 "writes the information to be used for cropping after rectification into this text file.",
166 * writeOutCropParams =
168 "writeCroppedCamParams",
169 "If this is active no cropping is performed. "
170 "Only the camera parameters fitting the cropped, rectified images are written out.",
178 string* leftList = params.
AddParamString(
"leftList",
"leftImagesList",
"",
180 string* rightList = params.
AddParamString(
"rightList",
"leftImagesList",
184 "left camera Params",
"", 0, groupID);
187 "left camera Params",
"", 0, groupID);
189 string* outdir = params.
AddParamString(
"outputDir",
"output directory",
192 bool* keepType = params.
AddParamBool(
"keepType",
"keep filetype of image",
195 string* newType = params.
AddParamString(
"newType",
"new image type",
"png",
198 bool* writeRectParams = params.
AddParamBool(
"writeRectParams",
199 "write out rectified camera parameters",
false, 0, groupID);
201 int* bordercolor2 = params.
AddParamInt(
"borderSecond",
202 "color of border in second view", 255, 0, 255, 0, groupID);
205 "file that contains or shall contain the rect setup",
"", 0,
208 bool* forceModulo4size = params.
AddParamBool(
"forceModulo4size",
209 "Result images are extended "
210 "at the lower and/or right edges to fit into modulo 4 size."
211 "!) Camera parameters are adapted accordingly."
212 "!) Feature is disabled if crop is true.",
false, 0, groupID);
219 cout <<
"\nusage:\n";
220 cout << argv[0] <<
" [options] <origImgA> <origImgB>\n";
225 if (*cropImages && *writeOutCropParams) {
226 cout <<
"crop and writeCroppedCamParams are both active!\n";
227 cout <<
"writeCroppedCamParams is ambiguouse when crop is active!\n";
228 cout <<
"Turn one option off!\n";
248 bool useSetup =
false;
249 bool generateSetup =
false;
250 if (rectSetupName->size() > 0) {
252 if (ImageIO::Load(*rectSetupName, rectSetup) < 0) {
253 cerr <<
"could not open rectified setup file " << *rectSetupName
255 cerr <<
"will create it from given params .\n";
256 generateSetup =
true;
264 * rectifierPM = NULL;
270 OutStorageType> (1.3);
280 case planarKeepAspect: {
281 cout <<
"Using planar rectification with preserved aspectratio" << endl;
284 unsigned char, OutStorageType> ();
289 cerr <<
" unknown rectification type : "
290 << rectificationTypes[*rectType] << endl;
295 switch (*interType) {
304 int destWidth = (*targetResolution)[0];
305 int destHeight = (*targetResolution)[1];
307 if (destHeight > 0 || destWidth > 0) {
312 <<
"cropping requested but no destination image dimensions set. disabling crop"
322 unsigned int imageNum;
323 vector<string> leftImageNames;
324 vector<string> rightImageNames;
325 if (leftList->empty() && rightList->empty()) {
327 if (fup + 1 >= argc) {
328 cout <<
"You must specify image list files with --leftList and --rightList " << endl
329 <<
"or two image file names as parameters!" << endl;
332 leftImageNames.push_back(argv[fup]);
333 rightImageNames.push_back(argv[fup + 1]);
335 if (Param::ParseListFile(*leftList, leftImageNames) != 0) {
336 BIASERR(
"error parsing left list");
339 if (Param::ParseListFile(*rightList, rightImageNames) != 0) {
340 BIASERR(
"error parsing right list");
343 imageNum = leftImageNames.size();
344 BIASASSERT(imageNum == rightImageNames.size());
348 if (!leftCamParams->empty()) {
349 if (camAproj.
Load(*leftCamParams) != 0) {
350 BIASERR(
"error reading left camera parameters");
353 if (!rightCamParams->empty()) {
354 if (camBproj.
Load(*rightCamParams) != 0) {
355 BIASERR(
"error reading right camera parameters");
365 for (
unsigned int i = 0; i < imageNum; i++) {
368 if (ImageIO::Load(leftImageNames[i], camA) != 0) {
369 cerr <<
"unable to load first camera '" << leftImageNames[i] <<
"'"
374 if (ImageIO::Load(rightImageNames[i], camB) != 0) {
375 cerr <<
"unable to load second camera '" << rightImageNames[i] <<
"'"
381 if (leftCamParams->empty() && i == 0) {
384 BIASERR(
"right camera projection not specified in image!");
390 if (rightCamParams->empty() && i == 0) {
393 BIASERR(
"right camera projection not specified in image!");
400 cerr <<
"invalid camera type for camera A!\n";
406 cerr <<
"invalid camera type for camera B!\n";
411 if (useSetup && i == 0) {
414 cerr <<
"rectification setup could not be created!\n";
418 if (ImageIO::Save(*rectSetupName, rectSetup) < 0) {
419 cerr <<
"error writing rectification setup into "
420 << *rectSetupName << endl;
425 cerr <<
"rectification setup could not be loaded!\n";
435 cerr <<
"rectification parameters could not be retrieved!\n";
446 if ((destHeight > 0 || destWidth > 0)) {
447 if ((*rectType != planar && *rectType != planarKeepAspect)) {
449 "cropping is only valid for planarily rectified images!");
500 zeroParallaxZ, roiA, roiB);
502 int roiHeight = roiA.GetCornerLowerRightY()
503 - roiA.GetCornerUpperLeftY();
504 int roiWidth = roiA.GetCornerLowerRightX()
505 - roiA.GetCornerUpperLeftX();
507 double adaptedScale = CalculateRescaleFactor(destWidth,
508 destHeight, roiWidth, roiHeight);
509 cout <<
"rescale for cropping : " << adaptedScale << endl;
510 rectifierPM->
SetScale(adaptedScale);
519 zeroParallaxZ, roiA, roiB,
true);
539 CentralCropRoi(destWidth, destHeight, roiA);
540 CentralCropRoi(destWidth, destHeight, roiB);
545 if (cropInformationFile->size() > 0) {
546 string outfileName = *outdir +
"/" + *cropInformationFile;
548 ofstream ofs(outfileName.c_str());
549 ofs <<
"** BIASrectify **\n"
550 <<
"** crop information for rectified images **\n\n";
552 ofs <<
"---> zero parallax = " << *zeroParallaxZ
555 ofs <<
"---> left images <---\n"
556 <<
"crop rect upper left ["
557 << roiA.GetCornerUpperLeftX() <<
", "
558 << roiA.GetCornerUpperLeftY() <<
"] (included)\n"
559 <<
"crop rect lower right ["
560 << roiA.GetCornerLowerRightX() <<
", "
561 << roiA.GetCornerLowerRightY() <<
"] (excluded)\n";
563 ofs <<
"---> right images <---\n"
564 <<
"crop rect upper left ["
565 << roiB.GetCornerUpperLeftX() <<
", "
566 << roiB.GetCornerUpperLeftY() <<
"] (included)\n"
567 <<
"crop rect lower right ["
568 << roiB.GetCornerLowerRightX() <<
", "
569 << roiB.GetCornerLowerRightY() <<
"] (excluded)\n";
572 <<
"\n\nATTENTION: Don't forget to adapt disaprity values if you are cropping disparity maps! \n";
574 <<
"The disparity values have to be changed by an amount of "
576 static_cast<int> (roiB.GetCornerUpperLeftX())
577 - static_cast<int> (roiA.GetCornerUpperLeftX()))
578 <<
" disparities.\n";
580 <<
"Whether to decrease or increase disparity values, depends on the definition of disparity and on the view of the cropped disparity map!\n";
584 if (*cropImages || *writeOutCropParams) {
592 rectPPATmp->
SetPrincipal(x - roiA.GetCornerUpperLeftX(), y
593 - roiA.GetCornerUpperLeftY());
596 rectPPBTmp->
SetPrincipal(x - roiB.GetCornerUpperLeftX(), y
597 - roiB.GetCornerUpperLeftY());
600 if (*writeOutCropParams) {
601 #ifdef BIAS_HAVE_XML2
607 "requested writing of camera parameters, but xml2 not enabled in BIAS");
617 unsigned char, OutStorageType
>*> (rectifierPM);
624 rectPPA = rectPPATmp;
625 rectPPB = rectPPBTmp;
631 cerr <<
"Found rectification parameters! \n ";
632 if (*forceModulo4size && !*cropImages) {
633 unsigned int width, height;
635 int missingW = width % 4;
636 int missingH = height % 4;
638 width = width + (4 - missingW);
641 height = height + (4 - missingH);
645 missingW = width % 4;
646 missingH = height % 4;
648 width = width + (4 - missingW);
651 height = height + (4 - missingH);
655 cerr <<
"camera A rectification state:\n" << *rectPPA << endl
657 cerr <<
"camera B rectification state:\n" << *rectPPB << endl
659 cerr <<
"rectifying ... " << endl;
665 if (rectifier->
Rectify() != 0) {
666 cerr <<
" failed \n";
681 if (*forceModulo4size != 0 && !*cropImages) {
682 unsigned int width, height;
687 rectA.
Pad(width, height, 0);
698 if (*forceModulo4size != 0 && !*cropImages) {
699 unsigned int width, height;
704 rectB.
Pad(width, height, *bordercolor2);
709 if (*writeRectParams) {
710 #ifdef BIAS_HAVE_XML2
715 "requested writing of camera parameters, but xml2 not enabled in BIAS");
719 string path1, basename1, suffix1;
720 string path2, basename2, suffix2;
721 FileHandling::SplitName(leftImageNames[i], path1, basename1, suffix1);
722 FileHandling::SplitName(rightImageNames[i], path2, basename2, suffix2);
724 string firstName = *outdir +
"/" + basename1 +
"_rect";
725 string secondName = *outdir +
"/" + basename2 +
"_rect";
728 firstName +=
"_cropped";
729 secondName +=
"_cropped";
733 if (ImageIO::Save(firstName + suffix1, rectA) != 0) {
734 cerr <<
"writing first rectified image failed!\n";
736 if (ImageIO::Save(secondName + suffix2, rectB) != 0) {
737 cerr <<
"writing first rectified image failed!\n";
740 if (newType->compare(
"") != 0) {
741 if (ImageIO::Save(firstName +
"." + *newType, rectA) != 0) {
742 cerr <<
"writing first rectified image failed!\n";
744 if (ImageIO::Save(secondName +
"." + *newType, rectB) != 0) {
745 cerr <<
"writing first rectified image failed!\n";
748 if (ImageIO::Save(firstName, rectA, ImageIO::FF_mip) != 0) {
749 cerr <<
"writing first rectified image failed!\n";
751 if (ImageIO::Save(secondName, rectB, ImageIO::FF_mip) != 0) {
752 cerr <<
"writing first rectified image failed!\n";
764 cerr <<
"generating vrmls with rectification data : \n";
765 cerr <<
"1. vrml containing only coordinate systems ... " << flush;
768 if (tdo.
VRMLOut(
"rectCoordinates.wrl") != 0) {
780 cerr <<
"2. generating vrml containing projected images ... "
782 unsigned int width = 0, height = 0;
789 for (
unsigned int y = 0; y < height; y++) {
790 for (
unsigned int x = 0; x < width; x++) {
797 RGBAuc theColor((
unsigned char) color,
798 (
unsigned char) color, (
unsigned char) color,
805 ImageConvert::ToRGB(rectA, RGBrectA);
808 ImageConvert::ConvertST(RGBrectA, tmp,
809 ImageBase::ST_unsignedchar);
816 for (
unsigned int y = 0; y < height; y++) {
817 for (
unsigned int x = 0; x < width; x++) {
823 unsigned char color = (
unsigned char) rint(
825 RGBAuc theColor(color, color, color, 255);
831 ImageConvert::ToRGB(rectB, RGBrectB);
834 ImageConvert::ConvertST(RGBrectB, tmp,
835 ImageBase::ST_unsignedchar);
841 cerr <<
" writing ..." << endl << flush;
842 tdo.
VRMLOut(
"rectCoordinates_image.wrl");
843 cerr <<
"writing mipview3d-animfile cylindersweep.anim" << endl;
844 ofstream myanimfile(
"cylindersweep.anim");
845 myanimfile <<
"[0] :43 0 0 0 0 1 0 0 0" << endl <<
"[0] :43 1000 "
846 << c[0] <<
" " << c[1] <<
" " << c[2] <<
" 1 0 0 0" << endl;
847 cerr <<
"3. generating wrl with orig cameras" << endl << flush;
851 ImageConvert::ToRGB(camA, RGBcamA);
853 ImageConvert::ToRGB(camB, RGBcamB);
862 cerr <<
" writing ..." << endl << flush;
888 unsigned int xmin = 0, xmax = w, ymin = 0, ymax = h;
896 ray3D[0] = midRay[0];
897 ray3D[1] = midRay[1];
898 ray3D[2] = midRay[2];
900 midPoint = rectProj->
Project(ray3D);
908 ray3D[0] = globalray[0];
909 ray3D[1] = globalray[1];
910 ray3D[2] = globalray[2];
912 edgepoint = rectProj->
Project(ray3D);
918 if (abs(grad[0]) > abs(grad[1])) {
920 if (edgepoint[1] > ymin) {
921 ymin = (unsigned)rint(edgepoint[1]);
924 if (edgepoint[1] < ymax) {
925 ymax = (unsigned)rint(edgepoint[1]);
931 if (edgepoint[0] > xmin) {
932 xmin = (unsigned)rint(edgepoint[0]);
935 if (edgepoint[0] < xmax) {
936 xmax = (unsigned)rint(edgepoint[0]);
958 vector<ProjectionParametersBase *> source;
959 vector<ProjectionParametersBase *> dest;
971 unsigned int xmin = 0, xmax = w, ymin = 0, ymax = h;
972 for (
unsigned int i = 0; i < source.size(); i++) {
975 source[i]->GetImageSize(mx, my);
978 source[i]->UnProjectToRay(midPoint, pos, midRay);
980 ray3D[0] = midRay[0];
981 ray3D[1] = midRay[1];
982 ray3D[2] = midRay[2];
984 midPoint = dest[i]->Project(ray3D);
985 source[i]->GetFirstBorderPixel(it);
991 source[i]->UnProjectToRay(sourcepoint, pos, globalray);
992 ray3D[0] = globalray[0];
993 ray3D[1] = globalray[1];
994 ray3D[2] = globalray[2];
996 edgepoint = dest[i]->Project(ray3D);
1002 if (abs(grad[0]) > abs(grad[1])) {
1004 if (edgepoint[1] > ymin) {
1005 ymin = (unsigned)rint(edgepoint[1]);
1008 if (edgepoint[1] < ymax) {
1009 ymax = (unsigned)rint(edgepoint[1]);
1015 if (edgepoint[0] > xmin) {
1016 xmin = (unsigned)rint(edgepoint[0]);
1019 if (edgepoint[0] < xmax) {
1020 xmax = (unsigned)rint(edgepoint[0]);
1029 }
while (source[i]->GetNextBorderPixel(it));
1041 double CalculateRescaleFactor(
int targetWidth,
int targetHeight,
int roiWidth,
1044 BIASASSERT(targetHeight > 0 || targetWidth > 0);
1047 if (targetHeight > 0)
1048 scaleH = float(targetHeight) / float(roiHeight);
1049 if (targetWidth > 0)
1050 scaleW = float(targetWidth) / float(roiWidth);
1052 float scale = (scaleW > scaleH) ? scaleW : scaleH;
1062 const double* zeroParallaxZ,
ROI& roiA,
ROI& roiB,
bool verbose) {
1064 findLargestRectangularRegion(camAproj, rectAproj, roiA);
1066 findLargestRectangularRegion(camBproj, rectBproj, roiB);
1070 double baseline = B.
NormL2();
1073 double parallaxDispTmp = f * (baseline / *zeroParallaxZ);
1076 if (*zeroParallaxZ >= 0)
1077 dispZP =
static_cast<int> (rint(parallaxDispTmp));
1078 BIASASSERT(dispZP >= 0);
1081 cout <<
"disparity of Zero Parallax " << dispZP << endl;
1118 commonUL[0] = max(rightUL[0], leftUL[0]);
1119 commonUL[1] = max(rightUL[1], leftUL[1]);
1120 commonLR[0] = min(rightLR[0], leftLR[0]);
1121 commonLR[1] = min(rightLR[1], leftLR[1]);
1124 cout <<
"identified left region : ";
1125 cout <<
"(" << leftUL[0] <<
"," << leftUL[1] <<
")" <<
"<-->("
1126 << leftLR[0] <<
"," << leftLR[1] <<
")\n";
1127 cout <<
"identified right region : ";
1128 cout <<
"(" << rightUL[0] <<
"," << rightUL[1] <<
")" <<
"<-->("
1129 << rightLR[0] <<
"," << rightLR[1] <<
")\n";
1131 cout <<
"identified common region : ";
1132 cout <<
"(" << commonUL[0] <<
"," << commonUL[1] <<
")" <<
"<-->("
1133 << commonLR[0] <<
"," << commonLR[1] <<
")\n";
1139 roiB.
SetCorners(commonUL[0] - dispZP, commonUL[1],
1140 commonLR[0] - dispZP, commonLR[1]);
1142 roiA.
SetCorners(commonUL[0], commonUL[1], commonLR[0], commonLR[1]);
1145 roiA.
SetCorners(commonUL[0] - dispZP, commonUL[1],
1146 commonLR[0] - dispZP, commonLR[1]);
1148 roiB.
SetCorners(commonUL[0], commonUL[1], commonLR[0], commonLR[1]);
1155 void CentralCropRoi(
int targetWidth,
int targetHeight,
ROI& roi) {
1162 int offsetWidth = 0;
1163 if (roiWidth > targetWidth) {
1164 offsetWidth = (roiWidth - targetWidth) / 2;
1167 lr[0] = ul[0] + targetWidth;
1169 int offsetHeight = 0;
1170 if (roiHeight > targetHeight) {
1171 offsetHeight = (roiHeight - targetHeight) / 2;
1174 lr[1] = ul[1] + targetHeight;
virtual BIAS::Vector3< double > GetC() const
Get projection center.
void RetainOriginalApectRatio(bool retain=true)
If this is set to true, the rectification will use the mean of the input pixel aspect ratios for the ...
virtual void SetPrincipal(const double x, const double y)
Set principal point (in pixels relative to top left corner).
class for handling different region of interest (ROI) representations...
unsigned int AddTriangleMesh(const TriangleMesh &mesh, const std::string &name="", const std::string &textureOutputName="", bool writeOutTexture=true, bool calcNormals=false)
Adds triangle mesh as IndexedFaceSet to ThreeDOut mem.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Base class for rectification implementations that make use of projections to represent rectified stat...
int VRMLOut(const std::string &sFilename)
flush all 3d objects to a vrml file with name sFilename, this is the function most users would call ...
virtual int Load(const std::string &filename)
convenience wrapper which tries to read different formats
void GenerateTexturedCamera(const ProjectionParametersBase *PPB, Image< unsigned char > &rgbtexture, const double &scale=1.0, const double &opacity=1.0, const double &resolution=1.0)
generates the sensor plane / cylinder / sphere in 3D space
int SetCorners(unsigned UpperLeftX, unsigned UpperLeftY, unsigned LowerRightX, unsigned LowerRightY)
Sets a rectangular region of interest.
void Resize(unsigned width, unsigned height)
Resizes parent image.
void GetRectifiedImageA(Image< OutputStorageType > &rectImg)
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
virtual int GetPrincipal(double &PrincipalX, double &PrincipalY) const
Get principal point (in pixels relative to top left corner).
class RGBAuc is asynonym for a Vector4 of corerct type
virtual void SetImageSize(const unsigned int w, const unsigned int h)
Set image dimensions (in pixels).
Unified output of 3D entities via OpenGL or VRML.
bool * AddParamBool(const std::string &name, const std::string &help, bool deflt=false, char cmdshort=0, int Group=GRP_NOSHOW)
double * AddParamDouble(const std::string &name, const std::string &help, double deflt=0.0, double min=-DBL_MAX, double max=DBL_MAX, char cmdshort=0, int Group=GRP_NOSHOW)
base class for rectification implementations and wrappers
virtual int GetClonesOfRectificationParameters(ProjectionParametersBase *&rectPPA, ProjectionParametersBase *&rectPPB)
Tries to calculate the rectification parameters and returns clones of internal members.
int SetRectificationSetup(Camera< float > &rectSetup)
Loads rectification setup from Camera data.
int * AddParamEnum(const std::string &name, const std::string &help, const std::vector< std::string > &enums, const int deflt=0, const std::vector< int > *IDs=NULL, const char cmdshort=0, const int Group=GRP_NOSHOW)
Class implements rectification by image projection onto a cylinder.
void SetScale(const double &scale)
Scale factor for isotropically scaling the rectified images (and rectified intrinsic parameters)...
unsigned int GetWidth() const
virtual void UnProjectToRay(const HomgPoint2D &pos, Vector3< double > &origin, Vector3< double > &direction, bool ignoreDistortion=false) const
Calculates the view ray, which belongs to the given position on the image plane, in global coordinate...
int ParseCommandLine(int &argc, char *argv[])
scan command line arguments for valid parameters
double NormL2() const
Return the L2 norm: sqrt(a^2 + b^2 + c^2 + d^2)
virtual HomgPoint2D Project(const HomgPoint3D &X, bool IgnoreDistortion=false) const
calculates the projection of a point in the world coordinate system to a pixel in the image plane of ...
unsigned int AddProjection(const Projection &p, const RGBAuc &colorSelection=RGBAuc_WHITE_OPAQUE, const double radius=0.1, const double scale=1.0, const std::string &identifier="", const int camera_type=-1)
Add a projection object to ThreeDOut mem.
virtual void GetFirstBorderPixel(PixelIterator &it)
call this to start a run at the outer boundary of an image.
int GetRectificationSetup(Camera< float > &rectSetup)
Method returns the current rectification setup.
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
int Pad(BIAS::ImageBase &dest, const unsigned int &newwidth, const unsigned int &newheight, const int &padVal=0) const
This class hides the underlying projection model, like projection matrix, spherical camera...
BIAS::Vector< int > * AddParamVecInt(const std::string &name, const std::string &help, const BIAS::Vector< int > &deflt, char cmdshort=0, int Group=GRP_NOSHOW)
Add a parameter that expects a string on command line like "<value0> <value1> <value2> ...
void SetInterpolationMethod(InterpolationMethod interpolationType)
Determines the type of interpolation used when rectifying.
int XMLWrite(const std::string &Filename, int CompressionLevel=0, bool AutoAddCompressionSuffix=true, std::string encoding="UTF-8") const
call this to add the class to a new xml tree and write it to the file Filename.
Create and represent a 3D triangle mesh.
int SetProj(const Projection &Proj)
void GetFocalLength(double &f) const
Get the current camera focal length.
unsigned int GetHeight() const
void FixateIntrinsics(const ProjectionParametersPerspective &ppp)
int GetFreeGroupID()
returns unused group id
Class implements rectification by image projection onto a sphere.
void UseLookUpTables(bool use)
Method allows to turn on or off the use of look up tables.
Rectification via perspective cameras, removes distortions.
unsigned int AddLine(const BIAS::Vector3< double > &Start, const BIAS::Vector3< double > &End, const BIAS::RGBAuc &Color=RGBAuc_WHITE_OPAQUE)
void SetSecondFill(OutputStorageType d)
fill color for second image (first is black)
virtual int SetCameraB(BIAS::Camera< InputStorageType > &cam)
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
virtual int Rectify()=0
Fundamental method which contains the rectification implementation.
Can be used to run along the image border.
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
double x
If using BorderPixel methods these are the coordinates of the pixel.
int UpdateMetaData()
copy P_ and co.
This class Param provides generic support for parameters.
int SetGroupName(const int group_id, const std::string &name)
sets the name for a group
void GetRectifiedImageB(Image< OutputStorageType > &rectImg)
int * AddParamInt(const std::string &name, const std::string &help, int deflt=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), char cmdshort=0, int Group=GRP_NOSHOW)
For all adding routines:
virtual int SetCameraA(BIAS::Camera< InputStorageType > &cam)
unsigned int AddPoint(const BIAS::Vector3< double > &v, const BIAS::RGBAuc &Color=RGBAuc_WHITE_OPAQUE)
unsigned GetCornerLowerRightY() const
fetch individual ROI corner coordinate
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
const BIAS::Projection & GetProj() const
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
int ParseMetaData(bool bUse2x64bitTS=true)
After ImageIO::Load() operated on AppData_, this method fills P_, Timestamp, DC_*, ...
unsigned GetCornerUpperLeftY() const
fetch individual ROI corner coordinate
unsigned GetCornerLowerRightX() const
fetch individual ROI corner coordinate
double NormL2() const
the L2 norm sqrt(a^2 + b^2 + c^2)
virtual HomgPoint3D UnProjectToImagePlane(const HomgPoint2D &pos, const double &depth=1.0, bool IgnoreDistortion=false) const =0
map points from image onto unit diameter image plane in 3D.
virtual bool GetNextBorderPixel(PixelIterator &it)
call this iteratively to run at the outer boundary of an image.
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase
unsigned GetCornerUpperLeftX() const
fetch individual ROI corner coordinate