|
|
|
|
@ -5723,6 +5723,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -5723,6 +5723,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
|
|
|
|
|
DEBUG_EXTRA("开始新的虚拟面片创建逻辑: 基于视图排序"); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// 1. 计算每个视图的覆盖情况
|
|
|
|
|
Util::Progress progress1(_T("计算视图覆盖"), images.size()); |
|
|
|
|
for (IIndex idxView = 0; idxView < images.size(); ++idxView) { |
|
|
|
|
@ -5835,6 +5836,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -5835,6 +5836,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
DEBUG_EXTRA("排序后视图数量: %zu,最大覆盖: %d, 共%d", viewCoverage.size(), |
|
|
|
|
viewCoverage.empty() ? 0 : viewCoverage[0].second, totalCoverage); |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
float thMaxColorDeviation = 130.0f; |
|
|
|
|
|
|
|
|
|
const float ratioAngleToQuality(0.67f); |
|
|
|
|
@ -5949,6 +5951,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -5949,6 +5951,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
const Normal& normalCenter = scene.mesh.faceNormals[virtualFaceCenterFaceID]; |
|
|
|
|
|
|
|
|
|
std::map<IIndex, float> mapSortedcams; |
|
|
|
|
std::map<IIndex, float> mapSortedcams2; |
|
|
|
|
for (IIndex idxView : selectedCams) |
|
|
|
|
{ |
|
|
|
|
const Image& imageData = images[idxView]; |
|
|
|
|
@ -5995,6 +5998,24 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -5995,6 +5998,24 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
mapSortedcams[idxView] = angleDeg; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!scene.is_face_delete_edge(strName, virtualFaceCenterFaceID)) { |
|
|
|
|
|
|
|
|
|
if (scene.is_face_edge(strName, virtualFaceCenterFaceID)) |
|
|
|
|
{ |
|
|
|
|
// if (angleDeg <= 20.0f)
|
|
|
|
|
{ |
|
|
|
|
mapSortedcams2[idxView] = angleDeg; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// if (angleDeg <= 40.0f)
|
|
|
|
|
{ |
|
|
|
|
mapSortedcams2[idxView] = angleDeg; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 将map中的元素放入vector以便排序
|
|
|
|
|
@ -6010,12 +6031,50 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -6010,12 +6031,50 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
return a.second < b.second; // 按angleDeg排序
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 将map中的元素放入vector以便排序
|
|
|
|
|
std::vector<std::pair<IIndex, float>> sortedCams2; |
|
|
|
|
sortedCams2.reserve(mapSortedcams2.size()); |
|
|
|
|
for (const auto& pair : mapSortedcams2) { |
|
|
|
|
sortedCams2.emplace_back(pair.first, pair.second); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 按angleDeg从小到大排序
|
|
|
|
|
std::sort(sortedCams2.begin(), sortedCams2.end(), |
|
|
|
|
[](const std::pair<IIndex, float>& a, const std::pair<IIndex, float>& b) { |
|
|
|
|
return a.second < b.second; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
IIndexArr filteredCams; |
|
|
|
|
|
|
|
|
|
int nHit = 0; |
|
|
|
|
int nHitMax = 1; |
|
|
|
|
int nViewCoverage = 0; |
|
|
|
|
int nViewCoverageMax = -1; |
|
|
|
|
int nViewCoverageMax = 20; |
|
|
|
|
int nHit = 0; |
|
|
|
|
int nHitMax = 10; |
|
|
|
|
for (size_t i = 0; i < sortedCams2.size(); ++i) |
|
|
|
|
{ |
|
|
|
|
if (nViewCoverage>=nViewCoverageMax) |
|
|
|
|
// if (nHit>nHitMax)
|
|
|
|
|
break; |
|
|
|
|
IIndex viewIdx = sortedCams2[i].first; |
|
|
|
|
float val = sortedCams2[i].second; |
|
|
|
|
|
|
|
|
|
const Image& imageData = images[viewIdx]; |
|
|
|
|
std::string strPath = imageData.name; |
|
|
|
|
std::string strName = MeshTexture::GetFileNameWithoutExtension(strPath); |
|
|
|
|
|
|
|
|
|
// if (!scene.is_face_delete_edge2(strName, virtualFaceCenterFaceID))
|
|
|
|
|
{ |
|
|
|
|
filteredCams.push_back(viewIdx); |
|
|
|
|
++nHit; |
|
|
|
|
|
|
|
|
|
if (nHit>=nHitMax) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
++nViewCoverage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
for (const auto& [viewIdx, coverageCount] : viewCoverage) { |
|
|
|
|
if (nViewCoverage>=nViewCoverageMax) |
|
|
|
|
// if (nHit>nHitMax)
|
|
|
|
|
@ -6066,6 +6125,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
@@ -6066,6 +6125,7 @@ bool MeshTexture::CreateVirtualFaces64(FaceDataViewArr& facesDatas, FaceDataView
|
|
|
|
|
|
|
|
|
|
++nViewCoverage; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
if (filteredCams.empty()) { |
|
|
|
|
size_t count = std::min(sortedCams.size(), static_cast<size_t>(3)); |
|
|
|
|
|