diff --git a/README.md b/README.md index ae89d60d368bc4c3558ea2c2735a0c7808eefd36..381d6b036a7e2990df7e6bd4ae7a04a64a431b2b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Once you have built the system or downloaded the binaries (see above), go to *in ``` You will have an interactive viewer and you can navigate freely in the captured scene. -Our default interactive viewer has a main view running the algorithm and a top view to visualize the position of the calibrated cameras. By default you are in WASD mode, and can toggle to trackball using the "y" key. Please see the page [Interface](https://sibr.gitlabpages.inria.fr/docs/develop/howto_sibr_useful_objects.html) for more details on the interface. +Our default interactive viewer has a main view running the algorithm and a top view to visualize the position of the calibrated cameras. By default you are in WASD mode, and can toggle to trackball using the "y" key. Please see the page [Interface](https://sibr.gitlabpages.inria.fr/docs/nightly/howto_sibr_useful_objects.html) for more details on the interface. Please see the documentation on how to create a dataset from your own scene, and the various other IBR algorithms available. diff --git a/docs/pages/1_Getting_Started.dox b/docs/pages/1_Getting_Started.dox index e300a8fd598c24851da70aa94765fce070f62ff5..1b81ee94788b5c2ed92277bfe17d4dbd08afaf4f 100644 --- a/docs/pages/1_Getting_Started.dox +++ b/docs/pages/1_Getting_Started.dox @@ -83,7 +83,7 @@ Once you have built the system or downloaded the binaries (see above), go to *in ``` You will have an interactive viewer and you can navigate freely in the captured scene. -Our default interactive viewer has a main view running the algorithm and a top view to visualize the position of the calibrated cameras. By default you are in WASD mode, and can toggle to trackball using the "y" key. Please see the page [Interface](https://sibr.gitlabpages.inria.fr/docs/develop/howto_sibr_useful_objects.html) for more details on the interface. +Our default interactive viewer has a main view running the algorithm and a top view to visualize the position of the calibrated cameras. By default you are in WASD mode, and can toggle to trackball using the "y" key. Please see the page [Interface](https://sibr.gitlabpages.inria.fr/docs/nightly/howto_sibr_useful_objects.html) for more details on the interface. @subsection sibr_prerequisite Prerequisites diff --git a/docs/pages/Tutorials/Paths_and_cameras.dox b/docs/pages/Tutorials/Paths_and_cameras.dox index b34ea3f7e632e7b53fb5acee928974df1535092c..14b181a089b42696aa30a5608014769784a0ea8b 100644 --- a/docs/pages/Tutorials/Paths_and_cameras.dox +++ b/docs/pages/Tutorials/Paths_and_cameras.dox @@ -42,6 +42,8 @@ alignMeshes.exe --path2Align dataset2Align --pathRef refDataset --out outputPath ``` This will align the two datasets, and write the aligned mesh in <code>outputPath</code> as well as the file <code>transform.txt</code> that contains the transformation matrix of the <code>dataset2Align</code> to <code>refDataset</code>. +Please note that alignMeshes may not manage to completely align meshes: please lalways compare the aligned mesh with the target (e.g., using meshlab). If alignmeshes fails, an alternative is to use a manual tool such as CloudCompare or meshlab. + You can then transform a camera path defined in the first dataset to the a path in the reference dataset: ``` @@ -49,5 +51,4 @@ cameraConverter_rwdi.exe --input inputPath.(out|lookat|path|tst) --output output cameraConverter.exe --input inputPath.(out|lookat|path|tst) --output outputPath.(out|lookat|path|tst) ``` - */ diff --git a/src/core/assets/InputCamera.cpp b/src/core/assets/InputCamera.cpp index 93bed914f685afc6e0ef22c1de545e4d644a4774..862627a73579eee4a43c4765781aa75325c6f9f1 100755 --- a/src/core/assets/InputCamera.cpp +++ b/src/core/assets/InputCamera.cpp @@ -21,11 +21,12 @@ #define SIBR_INPUTCAMERA_BINARYFILE_VERSION 10 #define IBRVIEW_TOPVIEW_SAVEVERSION "version002" +#define FOCAL_X_UNDEFINED -1 namespace sibr { InputCamera::InputCamera(float f, float k1, float k2, int w, int h, int id) : - _focal(f), _k1(k1), _k2(k2), _w(w), _h(h), _id(id), _active(true), _name(""), _focalx(-1) + _focal(f), _k1(k1), _k2(k2), _w(w), _h(h), _id(id), _active(true), _name(""), _focalx(FOCAL_X_UNDEFINED) { // Update fov and aspect ratio. float fov = 2.0f * atan(0.5f * h / f); @@ -64,7 +65,7 @@ namespace sibr _h = h; _focal = m(0); - _focalx = -1; + _focalx = FOCAL_X_UNDEFINED; _k1 = m(1); _k2 = m(2); @@ -107,7 +108,7 @@ namespace sibr _h = h; _focal = focal; - _focalx = -1; + _focalx = FOCAL_X_UNDEFINED; _k1 = k1; _k2 = k2; @@ -131,7 +132,7 @@ namespace sibr InputCamera::InputCamera(const Camera& c, int w, int h) : Camera(c) { _focal = 1.0f / (tan(0.5f * fovy()) * 2.0f / float(h)); - _focalx = -1; + _focalx = FOCAL_X_UNDEFINED; _k1 = _k2 = 0; _w = w; _h = h; diff --git a/src/projects/dataset_tools/preprocess/cameraConverter/main.cpp b/src/projects/dataset_tools/preprocess/cameraConverter/main.cpp index e6cc27e805da5a2dc4e91d8a717fec69bead89fd..271a26ad98dfcbc764ae07bc2deadb376d7ea1e3 100644 --- a/src/projects/dataset_tools/preprocess/cameraConverter/main.cpp +++ b/src/projects/dataset_tools/preprocess/cameraConverter/main.cpp @@ -92,15 +92,14 @@ void colmapSave(const std::string& filename, const std::vector<InputCamera::Ptr> outputColmapPathCams << "# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]" << std::endl; outputColmapPathCams << "# Number of cameras: 1" << std::endl; if (focalx == -1) { - focalx = xformPath[0]->focal(); - SIBR_WRG << "No focal x given making it equal to focaly; use result at own risk. Should have a colmap dataset as input" << std::endl; + focalx = xformPath[0]->focal() * xformPath[0]->aspect(); // use aspect ratio + SIBR_WRG << "No focal x given making it equal to focaly * aspect ratio; use result at own risk. Should have a colmap dataset as input" << std::endl; } - else - { - std::cerr << "FX " << focalx << std::endl; - focalx = xformPath[0]->focal() * (focalx / focaly); - SIBR_WRG << "Focal x set to " << focalx<<std::endl; - + else + { + std::cerr << "FX " << focalx << std::endl; + focalx = xformPath[0]->focal() * (focalx / focaly); + SIBR_WRG << "Focal x set to f / (fx/fy); f of first image :" << focalx<<std::endl; } for(int i=0; i<xformPath.size(); i++) { outputColmapPathCams << i+1 << " PINHOLE " << xformPath[0]->w()*scale << " " << xformPath[0]->h()*scale @@ -165,10 +164,10 @@ int main(int ac, char** av) { float focaly = cams[0]->focal(); // y by default float focalx = cams[0]->focalx(); - std::cerr << "COLMAP " << args.colmapPath << std::endl; // if a path is given try and get focalx std::vector<InputCamera::Ptr> camsFx; if (args.colmapPath != "") { + std::cerr << "COLMAP " << args.colmapPath << std::endl; std::string cm_sparse_path = args.colmapPath.get() + "/stereo/sparse"; if (directoryExists(cm_sparse_path)) { camsFx = InputCamera::loadColmap(cm_sparse_path, 0.01, 1000, 1); @@ -214,7 +213,7 @@ int main(int ac, char** av) { const std::string outExt = sibr::getExtension(args.output); if (outExt == "path") { save(args.output, cams); - } else if (outExt == "out") { + } else if (outExt == "out") { // bundler std::vector<InputCamera::Ptr> outCams; for(const auto & cam : cams) { const int outH = int(args.outputRes.get()[1]); @@ -232,10 +231,9 @@ int main(int ac, char** av) { const int outW = int(std::round(cam->aspect() * float(outH))); outCams.push_back(std::make_shared<InputCamera>(*cam, outW, outH)); } - //sibr::InputCamera::saveAsLookat(outCams, args.output, args.bundleImageList, args.bundleImageFiles); sibr::InputCamera::saveAsLookat(outCams, args.output); } - else if (getFileName(args.output) == "images.txt" ) { + else if (getFileName(args.output) == "images.txt" ) { // colmap colmapSave(args.output, cams, args.scale, focaly, focalx); } else { SIBR_ERR << "Unsupported output file extension: " << outExt << "." << std::endl;