31 #include <Utils/TriangleMesh.hh>
32 #include <Utils/ThreeDOut.hh>
33 #include <Base/Image/ImageIO.hh>
34 #include <Filter/Rescale.hh>
35 #include <Base/Common/FileHandling.hh>
36 #include <Image/Camera.hh>
38 #include <Base/Math/Random.hh>
45 #define TILE_WIDTH 129
46 #define TILE_HEIGHT 129
48 void usage(
char* name)
51 cout<<name<<
" <depthmap> <texture> [projection] \n";
55 int main(
int argc,
char* argv[])
64 if(ImageIO::Load(argv[2], texture)!=0) {
65 cout<<
"texture could not be loaded!\n";
71 if(ImageIO::Load(argv[1], depthMap)!=0) {
72 cout<<
"depth map could not be loaded!\n";
74 if (
string(argv[1])==
string(
"UNITSPHERE")) {
84 if (argc>3)
if (P.
Load(argv[2])==0) loaded =
true;
91 cout<<
"Projection could not be loaded from file or meta data!\n";
98 cout<<
"meshing..."; cout.flush();
99 double minCornerAngle = 3.0*M_PI/180.0;
100 double maxViewingAngle = 91.0 * M_PI / 180.0;
102 minCornerAngle = atof(argv[4])*M_PI/180.0;
104 cout<<
"minCornerAngle = "<<minCornerAngle<<endl;
116 double hws2 = hws + 2;
117 for (
unsigned int q=0; q<30; q++) {
125 for (
unsigned int i=0; i<4; i++) {
128 case 0: p[i][0] -= hws; p[i][1] -= hws;
break;
129 case 1: p[i][0] += hws; p[i][1] -= hws;
break;
130 case 2: p[i][0] -= hws; p[i][1] += hws;
break;
131 case 3: p[i][0] += hws; p[i][1] += hws;
break;
140 mesh.GenerateTexturedQuad(Pmat, texture, X[0], X[1], X[2], X[3]);
143 string vrmlfilename =
"Quad.wrl";
144 cout<<
"Writing VRML to "<<vrmlfilename<<flush<<endl;
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.
double BilinearInterpolation(const double x, const double y, const unsigned short int channel=0) const
Generic bilinear interpolation.
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
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
Unified output of 3D entities via OpenGL or VRML.
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
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...
Create and represent a 3D triangle mesh.
unsigned int GetHeight() const
void FillImageWithConstValue(StorageType Value)
fill grey images
virtual BIAS::PMatrix GetP() const
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
Vector3< double > UnProjectToPoint(const HomgPoint2D &pos, double depth, unsigned int cam=0, bool IgnoreDistortion=false) const
calculates a 3D point in the global (not the rig) coordinate system, which belongs to the image posit...
describes a projective 3D -> 2D mapping in homogenous coordinates
const BIAS::Projection & GetProj() const
int ParseMetaData(bool bUse2x64bitTS=true)
After ImageIO::Load() operated on AppData_, this method fills P_, Timestamp, DC_*, ...
class for producing random numbers from different distributions