From f7c1029fb7b8144a5d3ed00417bda4b456a9c2ff Mon Sep 17 00:00:00 2001 From: Pau Gargallo Date: Thu, 27 Aug 2015 18:35:46 +0200 Subject: [PATCH 1/3] Check if force-focal/force-ccd arguments are given --- run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 1bb1862d..cfbb578e 100755 --- a/run.py +++ b/run.py @@ -340,14 +340,14 @@ def prepare_objects(): fileObject["width"] = int(match.group(1).strip()) fileObject["height"] = int(match.group(2).strip()) - if '--force-focal' not in args: + if args.force_focal is None: match = re.search(":[\ ]*([0-9\.]*)mm", file_focal) if match: fileObject["focal"] = float((match.group()[1:-2]).strip()) else: fileObject["focal"] = args.force_focal - if '--force-ccd' not in args: + if args.force_ccd is None: match = re.search(":[\ ]*([0-9\.]*)mm", file_ccd) if match: fileObject["ccd"] = float(match.group()[1:-2].strip()) From 7d5feb949d5ca6eb7d38479df54c5490b656a843 Mon Sep 17 00:00:00 2001 From: Dakota Benjamin Date: Thu, 27 Aug 2015 13:54:29 -0400 Subject: [PATCH 2/3] Remove depreciated Lowe's SIFT --- run.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/run.py b/run.py index d7d3f69c..11722a91 100755 --- a/run.py +++ b/run.py @@ -484,21 +484,14 @@ def getKeypoints(): c += 1 if fileObject["isOk"]: - if '--lowe-sift' in args: + if not os.path.isfile(jobOptions["jobDir"] + "/" + fileObject["base"] + ".key.bin"): vlsiftJobs += "echo -n \"" + str(c) + "/" + str(objectStats["good"]) + " - \" && convert -format pgm \"" + fileObject["step_0_resizedImage"] + "\" \"" + fileObject["step_1_pgmFile"] + "\"" - vlsiftJobs += " && \"" + BIN_PATH + "/sift\" < \"" + fileObject["step_1_pgmFile"] + "\" > \"" + fileObject["step_1_keyFile"] + "\"" + vlsiftJobs += " && \"" + BIN_PATH + "/vlsift\" \"" + fileObject["step_1_pgmFile"] + "\" -o \"" + fileObject["step_1_keyFile"] + ".sift\" > /dev/null && perl \"" + BIN_PATH + "/../convert_vlsift_to_lowesift.pl\" \"" + jobOptions["jobDir"] + "/" + fileObject["base"] + "\"" vlsiftJobs += " && gzip -f \"" + fileObject["step_1_keyFile"] + "\"" vlsiftJobs += " && rm -f \"" + fileObject["step_1_pgmFile"] + "\"" vlsiftJobs += " && rm -f \"" + fileObject["step_1_keyFile"] + ".sift\"\n" else: - if not os.path.isfile(jobOptions["jobDir"] + "/" + fileObject["base"] + ".key.bin"): - vlsiftJobs += "echo -n \"" + str(c) + "/" + str(objectStats["good"]) + " - \" && convert -format pgm \"" + fileObject["step_0_resizedImage"] + "\" \"" + fileObject["step_1_pgmFile"] + "\"" - vlsiftJobs += " && \"" + BIN_PATH + "/vlsift\" \"" + fileObject["step_1_pgmFile"] + "\" -o \"" + fileObject["step_1_keyFile"] + ".sift\" > /dev/null && perl \"" + BIN_PATH + "/../convert_vlsift_to_lowesift.pl\" \"" + jobOptions["jobDir"] + "/" + fileObject["base"] + "\"" - vlsiftJobs += " && gzip -f \"" + fileObject["step_1_keyFile"] + "\"" - vlsiftJobs += " && rm -f \"" + fileObject["step_1_pgmFile"] + "\"" - vlsiftJobs += " && rm -f \"" + fileObject["step_1_keyFile"] + ".sift\"\n" - else: - print "using existing " + jobOptions["jobDir"] + "/" + fileObject["base"] + ".key.bin" + print "using existing " + jobOptions["jobDir"] + "/" + fileObject["base"] + ".key.bin" siftDest = open(jobOptions["step_1_vlsift"], 'w') siftDest.write(vlsiftJobs) From fa1c04a6cee143e1e0ba3502ec3496c13baa6929 Mon Sep 17 00:00:00 2001 From: Dakota Benjamin Date: Fri, 28 Aug 2015 09:21:19 -0400 Subject: [PATCH 3/3] Revert "Texture using best available camera" --- .gitignore | 3 +- odm_texturing/CMakeLists.txt.user | 203 +++++++++++++++++++++++++++++ odm_texturing/src/OdmTexturing.cpp | 60 ++------- 3 files changed, 214 insertions(+), 52 deletions(-) create mode 100644 odm_texturing/CMakeLists.txt.user diff --git a/.gitignore b/.gitignore index 40869556..f2045dc4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ include/ lib/ logs/ src/ -odm_texturing-build/ -*.user + cmvs.tar.gz parallel.tar.bz2 pcl.tar.gz 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 ecb07b53..188d206b 100644 --- a/odm_texturing/src/OdmTexturing.cpp +++ b/odm_texturing/src/OdmTexturing.cpp @@ -397,11 +397,6 @@ void OdmTexturing::triangleToImageAssignment() // Vector containing information if the face has been given an optimal camera or not std::vector hasOptimalCamera = std::vector(mesh_->tex_polygons[0].size()); - //Vector containing minimal distances to optimal camera - std::vector tTIA_distances(mesh_->tex_polygons[0].size(),DBL_MAX); - //Vector containing minimal angles of face to cameraplane normals - std::vector tTIA_angles(mesh_->tex_polygons[0].size(),DBL_MAX); - // Set default value that no face has an optimal camera for (size_t faceIndex = 0; faceIndex < hasOptimalCamera.size(); ++faceIndex) { @@ -489,8 +484,7 @@ void OdmTexturing::triangleToImageAssignment() } - std::vector local_tTIA_distances(mesh_->tex_polygons[0].size(),DBL_MAX); - std::vector local_tTIA_angles(mesh_->tex_polygons[0].size(),DBL_MAX); + // If any faces are visible in the current camera perform occlusion culling if (countInsideFrustum > 0) { @@ -524,45 +518,16 @@ void OdmTexturing::triangleToImageAssignment() // Perform radius search in the acceleration structure int radiusSearch = kdTree.radiusSearch(center, radius, neighbors, neighborsSquaredDistance); - // Extract distances for all vertices for face to camera - double d0 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[0]].z; - double d1 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[1]].z; - double d2 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[2]].z; - - // Calculate largest distance and store in distance variable - double distance = std::max(d0, std::max(d1,d2)); - - //Get points - pcl::PointXYZ p0=cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[0]]; - pcl::PointXYZ p1=cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[1]]; - pcl::PointXYZ p2=cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[2]]; - //Calculate face normal - - pcl::PointXYZ diff0; - pcl::PointXYZ diff1; - diff0.x=p1.x-p0.x; - diff0.y=p1.y-p0.y; - diff0.z=p1.z-p0.z; - diff1.x=p2.x-p0.x; - diff1.y=p2.y-p0.y; - diff1.z=p2.z-p0.z; - pcl::PointXYZ normal; - normal.x=diff0.y*diff1.z-diff0.z*diff1.y; - normal.y=-(diff0.x*diff1.z-diff0.z*diff1.x); - normal.z=diff0.x*diff1.y-diff0.y*diff1.x; - double norm=sqrt(normal.x*normal.x+normal.y*normal.y+normal.z*normal.z); - //Angle of face to camera - double cos=-normal.z/norm; - - //Save distance of faceIndex to current camera - local_tTIA_distances[faceIndex]=distance; - - //Save angle of faceIndex to current camera - local_tTIA_angles[faceIndex]=sqrt(1.0-cos*cos); // If other projections are found inside the radius if (radiusSearch > 0) { + // Extract distances for all vertices for face to camera + double d0 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[0]].z; + double d1 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[1]].z; + double d2 = cameraCloud->points[mesh_->tex_polygons[0][faceIndex].vertices[2]].z; + // Calculate largest distance and store in distance variable + double distance = std::max(d0, std::max(d1,d2)); // Compare distance to all neighbors inside radius for (size_t i = 0; i < neighbors.size(); ++i) @@ -594,14 +559,9 @@ void OdmTexturing::triangleToImageAssignment() { if (visibility[faceIndex]) { - if(local_tTIA_distances[faceIndex]