Browse Source

路径bug修正

master
hesuicong 2 weeks ago
parent
commit
ca9de47023
  1. 15
      libs/MVS/SceneTexture.cpp

15
libs/MVS/SceneTexture.cpp

@ -840,8 +840,9 @@ bool MeshTexture::ListCameraFaces(FaceDataViewArr& facesDatas, float fOutlierThr
// if (strName!="74_8" && strName!="13_8" && strName!="61_8" && // if (strName!="74_8" && strName!="13_8" && strName!="61_8" &&
// strName!="92_8" && strName!="101_8" && strName!="102_8" && // strName!="92_8" && strName!="101_8" && strName!="102_8" &&
// strName!="103_8" && strName!="112_8" && strName!="113_8" && // strName!="103_8" && strName!="112_8" && strName!="113_8" &&
// strName!="122_8" && strName!="123_8" && strName!="132_8") // strName!="122_2" && strName!="123_2" && strName!="121_2")
if (strName!="76_8") // if (strName!="122_2")
if (strName!="122_2" && strName!="123_2" && strName!="121_2")
{ {
continue; continue;
} }
@ -9447,6 +9448,7 @@ bool Scene::LoadVisibleFacesData(std::map<std::string, std::unordered_set<int>>&
std::map<std::string, std::unordered_set<int>>& edge_faces_map, std::map<std::string, std::unordered_set<int>>& edge_faces_map,
std::map<std::string, std::unordered_set<int>>& delete_edge_faces_map, std::map<std::string, std::unordered_set<int>>& delete_edge_faces_map,
std::string& basePath) { std::string& basePath) {
printf("LoadVisibleFacesData %s\n", basePath.c_str());
std::ifstream mapFile(basePath + "_visible_faces_map.txt"); std::ifstream mapFile(basePath + "_visible_faces_map.txt");
if (!mapFile.is_open()) { if (!mapFile.is_open()) {
return false; return false;
@ -9592,13 +9594,20 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
printf("id=%s\n", id.c_str()); printf("id=%s\n", id.c_str());
#ifdef MASK_FACE_OCCLUSION #ifdef MASK_FACE_OCCLUSION
/*
fs::path p(baseFileName.c_str()); fs::path p(baseFileName.c_str());
// 2. 获取父路径 (e.g., /path/to/data/scene) // 2. 获取父路径 (e.g., /path/to/data/scene)
fs::path parent = p.parent_path(); fs::path parent = p.parent_path();
// 4. 转换为字符串,并附加一个路径分隔符 // 4. 转换为字符串,并附加一个路径分隔符
// ( / "" 会自动处理,确保 /path/to/data 变为 /path/to/data/ ) // ( / "" 会自动处理,确保 /path/to/data 变为 /path/to/data/ )
std::string basePath = (parent / "").string(); std::string basePath = (parent / "").string();
*/
std::string basePath = "";
size_t lastSlash = baseFileName.find_last_of('/');
size_t secondLastSlash = baseFileName.find_last_of('/', lastSlash - 1);
if (secondLastSlash == std::string::npos)
basePath = baseFileName;
basePath = baseFileName.substr(0, secondLastSlash + 1);
// printf("basePath=%s\n", basePath.c_str()); // printf("basePath=%s\n", basePath.c_str());

Loading…
Cancel
Save