From 45a219bd56598348b832014d29b5fc7b84158bec Mon Sep 17 00:00:00 2001 From: "Stephen V. Mather" Date: Mon, 9 Feb 2015 22:55:40 -0500 Subject: [PATCH] fix texturing bug Former-commit-id: 9fb9d67bd0ab4d7831da3f4295352e5d8aacfbfd --- odm_texturing/CMakeLists.txt.user | 203 +++++++++++++++++++++++++++++ odm_texturing/src/OdmTexturing.cpp | 21 ++- 2 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 odm_texturing/CMakeLists.txt.user diff --git a/odm_texturing/CMakeLists.txt.user b/odm_texturing/CMakeLists.txt.user new file mode 100644 index 00000000..cfc3ea3a --- /dev/null +++ b/odm_texturing/CMakeLists.txt.user @@ -0,0 +1,203 @@ + + + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + System + false + 4 + true + 1 + true + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + + CMakeProjectManager.DefaultCMakeTarget + 0 + 0 + 0 + + /home/spotscale/odm/OpenDroneMap_spotscale/odm_texturing4-build + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-32bit./usr/bin/gdb + ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-32bit./usr/bin/gdb + + + + + false + Make + + CMakeProjectManager.MakeStep + + 1 + Build + + ProjectExplorer.BuildSteps.Build + + + + clean + + true + Make + + CMakeProjectManager.MakeStep + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + all + + CMakeProjectManager.CMakeBuildConfiguration + + 1 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + No deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + + + false + false + false + false + false + false + false + false + true + true + 0.01 + 0.01 + 10 + 10 + true + true + 25 + 25 + + + true + true + valgrind + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + odm_texturing + -verbose -bundleFile "../../../shared_folder/copr2/reconstruction-with-image-size-1200/bundle/bundle.out" -imagesPath "../../../shared_folder/copr2" -imagesListPath "../../../shared_folder/copr2/reconstruction-with-image-size-1200/list.txt" -inputModelPath "../../../shared_folder/copr2/reconstruction-with-image-size-1200-results/odm_mesh-0000.ply" -outputFolder "../../../shared_folder/copr2/reconstruction-with-image-size-1200-results/odm_texturing/" -textureResolution 4096 -textureWithSize 3600 -bundleResizedTo 1200 + false + + + odm_texturing + + CMakeProjectManager.CMakeRunConfiguration. + 3768 + true + false + false + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.EnvironmentId + {785a73be-b55f-490c-9d46-e1451c235840} + + + ProjectExplorer.Project.Updater.FileVersion + 10 + + diff --git a/odm_texturing/src/OdmTexturing.cpp b/odm_texturing/src/OdmTexturing.cpp index bec1f9cc..188d206b 100644 --- a/odm_texturing/src/OdmTexturing.cpp +++ b/odm_texturing/src/OdmTexturing.cpp @@ -342,13 +342,30 @@ void OdmTexturing::loadCameras() cam.pose = transform; std::getline(imageListFile, dummyLine); - cam.texture_file = imagesPath_ + dummyLine.substr(2,dummyLine.length()); + size_t firstWhitespace = dummyLine.find_first_of(" "); + + if (firstWhitespace != std::string::npos) + { + cam.texture_file = imagesPath_ + "/" + dummyLine.substr(2,firstWhitespace-2); + } + else + { + cam.texture_file = imagesPath_ + "/" + dummyLine.substr(2); + } // Read image to get full resolution size cv::Mat image = cv::imread(cam.texture_file); + if (image.empty()) + { + throw OdmTexturingException("Failed to read image:\n'" + cam.texture_file + "'\n"); + } + + double imageWidth = static_cast(image.cols); + double textureWithWidth = static_cast(textureWithSize_); + // Calculate scale factor to texture with textureWithSize - double factor = textureWithSize_/static_cast(image.cols); + double factor = textureWithWidth/imageWidth; if (factor > 1.0f) { factor = 1.0f;