compiled with mingw
This commit is contained in:
parent
1a1844cb34
commit
b535e9293e
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <vcg/complex/allocate.h>
|
||||||
|
#include <vcg/complex/algorithms/update/bounding.h>
|
||||||
#include <wrap/callback.h>
|
#include <wrap/callback.h>
|
||||||
#include <wrap/io_trimesh/io_mask.h>
|
#include <wrap/io_trimesh/io_mask.h>
|
||||||
#include <wrap/Exif/include/Exif/jhead.h>
|
#include <wrap/Exif/include/Exif/jhead.h>
|
||||||
|
@ -35,13 +37,13 @@ namespace tri {
|
||||||
namespace io {
|
namespace io {
|
||||||
|
|
||||||
struct Correspondence{
|
struct Correspondence{
|
||||||
Correspondence(unsigned int id_img_,unsigned int key_,float x_,float y_):id_img(id_img_),key(key_),x(x_),y(y_){};
|
Correspondence(unsigned int id_img_,unsigned int key_,float x_,float y_):id_img(id_img_),key(key_),x(x_),y(y_){}
|
||||||
unsigned int id_img,key;
|
unsigned int id_img,key;
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Correspondence> CorrVec;
|
typedef std::vector<Correspondence> CorrVec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class encapsulate a filter for opening bundler file
|
This class encapsulate a filter for opening bundler file
|
||||||
|
@ -82,7 +84,7 @@ static bool ReadHeader(FILE *fp,unsigned int &num_cams, unsigned int &num_points
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ReadHeader(const char * filename,unsigned int &num_cams, unsigned int &num_points){
|
static bool ReadHeader(const char * filename,unsigned int &num_cams, unsigned int &num_points){
|
||||||
FILE *fp = fopen(s.c_str(), "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if(!fp) return false;
|
if(!fp) return false;
|
||||||
ReadHeader(fp);
|
ReadHeader(fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -129,22 +131,22 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
|
||||||
shots[i].Extrinsics.SetRot(mat);
|
shots[i].Extrinsics.SetRot(mat);
|
||||||
|
|
||||||
shots[i].Intrinsics.FocalMm = f;
|
shots[i].Intrinsics.FocalMm = f;
|
||||||
shot.Intrinsics.k[0] = 0.0;//k1; To be uncommented when distortion is taken into account reliably
|
shots[i].Intrinsics.k[0] = 0.0;//k1; To be uncommented when distortion is taken into account reliably
|
||||||
shot.Intrinsics.k[1] = 0.0;//k2;
|
shots[i].Intrinsics.k[1] = 0.0;//k2;
|
||||||
AddIntrinsics(shots[i],image_filenames[i].c_str());
|
AddIntrinsics(shots[i],image_filenames[i].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// load all correspondences
|
// load all correspondences
|
||||||
OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
typename OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::template GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
||||||
if(!vcg::tri::Allocator<OpenMeshType>::IsValidHandle(m,ch))
|
if(!vcg::tri::Allocator<OpenMeshType>::IsValidHandle(m,ch))
|
||||||
ch = vcg::tri::Allocator<OpenMeshType>::AddPerVertexAttribute<CorrVec>(m,"correspondences");
|
ch = vcg::tri::Allocator<OpenMeshType>::template AddPerVertexAttribute<CorrVec>(m,"correspondences");
|
||||||
|
|
||||||
OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
typename OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
||||||
for(int i = 0; i < num_points;++i,++vi){
|
for(int i = 0; i < num_points;++i,++vi){
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
unsigned int r,g,b,i_cam, key_sift,n_corr;
|
unsigned int r,g,b,i_cam, key_sift,n_corr;
|
||||||
fscanf(fp,"%f %f %f ",&x,&y,&z);
|
fscanf(fp,"%f %f %f ",&x,&y,&z);
|
||||||
(*vi).P() = vcg::Point3<OpenMeshType::ScalarType>(x,y,z);
|
(*vi).P() = vcg::Point3<typename OpenMeshType::ScalarType>(x,y,z);
|
||||||
fscanf(fp,"%d %d %d ",&r,&g,&b);
|
fscanf(fp,"%d %d %d ",&r,&g,&b);
|
||||||
(*vi).C() = vcg::Color4b(r,g,b,255);
|
(*vi).C() = vcg::Color4b(r,g,b,255);
|
||||||
|
|
||||||
|
@ -161,11 +163,11 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
|
||||||
return (shots.size() == 0);
|
return (shots.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > shots, const char * filename_out,const char * filename_list, CallBackPos *cb=0){
|
static int Open( OpenMeshType &m, std::vector<Shot<typename OpenMeshType::ScalarType> > shots, const char * filename_out,const char * filename_list, CallBackPos *cb=0){
|
||||||
QStringList image_files;
|
|
||||||
ReadHeader(filename_out);
|
ReadHeader(filename_out);
|
||||||
ReadImagesFilenames(QString(filename_list),list,num_cams);
|
std::vector<std::string> image_filenames;
|
||||||
return Open( m, shots,filename, image_files, cb);
|
ReadImagesFilenames(filename_list,image_filenames);
|
||||||
|
return Open( m, shots,filename_out, image_filenames, cb);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue