diff --git a/.gitignore b/.gitignore index d4a18b44..b0dff3ed 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,7 @@ lib/ logs/ share/ src/ -odm_texturing-build/ -*.user + cmvs.tar.gz parallel.tar.bz2 LAStools.zip 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] \"" + 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)