Example for camera object using, BIAS::Camera is an enhanced BIAS::Image with Metadata
- Author
- MIP
#include "Image/Camera.hh"
#include "Base/Image/ImageIO.hh"
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
if (argc>2) {
const std::string format(argv[2]);
if (format.compare("--daimler") == 0 ||
format.compare("-daimler") == 0)
{
inert.
Set(1.0, 2.0, 3.14, 4.2, 7.2);
gps.
Set(7, 1.5, 2.5, 3.5, 4.5, 5.5);
} else {
cout << "Use --daimler as second argument to use Daimler camera format." << endl;
return 0;
}
}
K[0][0]=K[1][1]=100;
if (argc>1) {
cout <<"Reading projection from "<<argv[1]<<endl;
}
cout <<endl<< "added meta data to camera: "<<endl;
BIASERR("error writing cam.mip");
return -1;
}
BIASERR("error reading cam.mip");
return -1;
}
cout <<endl<<
"====== now read from mip: \nC:\n" << cam2.
GetC()
<<
"\nR:\n"<<cam2.
GetR()<<
"\nK:\n"<<cam2.
GetK()
<<
"\nP:\n"<<cam2.
GetP()<<
" Projection: "<< cam2.
GetProj()<<endl;
cout <<"==== PrintAppData() from mip ======="<<endl;
cerr <<
"sizeof metadata: "<<cam.
GetMetaData()->size()<<endl;
BIASERR("error writing cam.pgm");
return -1;
}
BIASERR("error reading cam.pgm");
return -1;
}
cout <<endl<< "now read from pgm:"<<endl;
cout <<
"My Projection fom pgm: "<< cam3.
GetProj()<<endl;
return 0;
}