调试高低频分离
This commit is contained in:
1 parent
4d5f371e99
commit
73044aa575
1 file changed
+20
-17
+20
-17
@@ -16468,6 +16468,7 @@ bool MeshTexture::RasterizeVirtualFaces(
|
|||||||
// ========== 合成:低频用多视图融合,高频用主视图细节 ==========
|
// ========== 合成:低频用多视图融合,高频用主视图细节 ==========
|
||||||
cv::Mat finalPatch = lowFreqPatch + highFreq;
|
cv::Mat finalPatch = lowFreqPatch + highFreq;
|
||||||
// cv::Mat finalPatch = lowFreqPatch.clone();
|
// cv::Mat finalPatch = lowFreqPatch.clone();
|
||||||
|
// finalPatch = cv::Mat::zeros(finalPatch.size(), finalPatch.type());
|
||||||
|
|
||||||
// 钳制到 [0, 1]
|
// 钳制到 [0, 1]
|
||||||
cv::Mat clampedPatch;
|
cv::Mat clampedPatch;
|
||||||
@@ -16494,9 +16495,9 @@ bool MeshTexture::RasterizeVirtualFaces(
|
|||||||
if (currentScore > m_texelScores[idx].score) {
|
if (currentScore > m_texelScores[idx].score) {
|
||||||
if (atlasY >= 0 && atlasY < atlas.rows && atlasX >= 0 && atlasX < atlas.cols) {
|
if (atlasY >= 0 && atlasY < atlas.rows && atlasX >= 0 && atlasX < atlas.cols) {
|
||||||
cv::Vec3b& pixel = atlas.at<cv::Vec3b>(atlasY, atlasX);
|
cv::Vec3b& pixel = atlas.at<cv::Vec3b>(atlasY, atlasX);
|
||||||
pixel[0] = color[2];
|
pixel[0] = color[0];
|
||||||
pixel[1] = color[1];
|
pixel[1] = color[1];
|
||||||
pixel[2] = color[0];
|
pixel[2] = color[2];
|
||||||
}
|
}
|
||||||
m_texelScores[idx].score = currentScore;
|
m_texelScores[idx].score = currentScore;
|
||||||
m_texelScores[idx].viewID = mainView;
|
m_texelScores[idx].viewID = mainView;
|
||||||
@@ -16572,6 +16573,8 @@ bool MeshTexture::RasterizeVirtualFaces(
|
|||||||
if (m_texelPatchID[i] != NO_ID) validPixels++;
|
if (m_texelPatchID[i] != NO_ID) validPixels++;
|
||||||
DEBUG_EXTRA("m_texelPatchID: %d valid pixels out of %zu", validPixels, m_texelPatchID.size());
|
DEBUG_EXTRA("m_texelPatchID: %d valid pixels out of %zu", validPixels, m_texelPatchID.size());
|
||||||
|
|
||||||
|
// cv::imwrite("/home/algo/Documents/openMVS/data/546893/out.546893/debug_atlas_before_return.png", atlas);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22582,24 +22585,24 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
|
|||||||
nTextureSizeMultiple, colEmpty, textures))
|
nTextureSizeMultiple, colEmpty, textures))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
texture.MergeSameViewPatches();
|
// texture.MergeSameViewPatches();
|
||||||
DEBUG_EXTRA("=== After MergeSameViewPatches, calling BuildStandardSeamData ===");
|
// DEBUG_EXTRA("=== After MergeSameViewPatches, calling BuildStandardSeamData ===");
|
||||||
// // ★★★ 新增:构建标准接缝数据 + 调用全局/局部接缝消除 ★★★
|
// // // ★★★ 新增:构建标准接缝数据 + 调用全局/局部接缝消除 ★★★
|
||||||
// texture.BuildStandardSeamDataFromRCPatches(
|
// // texture.BuildStandardSeamDataFromRCPatches(
|
||||||
// virtualFaceMap, texture.faceViews, nTextureSizeMultiple);
|
// // virtualFaceMap, texture.faceViews, nTextureSizeMultiple);
|
||||||
|
|
||||||
// // 直接操作 atlas(不污染 images)
|
// // // 直接操作 atlas(不污染 images)
|
||||||
// texture.RunSeamLevelingOnAtlas(textures.back(), nTextureSizeMultiple);
|
// // texture.RunSeamLevelingOnAtlas(textures.back(), nTextureSizeMultiple);
|
||||||
|
|
||||||
// texture.RunGlobalColorOptimization(textures.back(), nTextureSizeMultiple, 0.1f); // λ=0.1 对齐 OpenMVS
|
// // texture.RunGlobalColorOptimization(textures.back(), nTextureSizeMultiple, 0.1f); // λ=0.1 对齐 OpenMVS
|
||||||
// texture.GlobalAlignPatches(textures.back(), nTextureSizeMultiple);
|
// // texture.GlobalAlignPatches(textures.back(), nTextureSizeMultiple);
|
||||||
// texture.LocalBlendSeams(textures.back(), nTextureSizeMultiple);
|
// // texture.LocalBlendSeams(textures.back(), nTextureSizeMultiple);
|
||||||
|
|
||||||
// ★★★ 新增:调用 GlobalSeamLeveling3 并重新光栅化 ★★★
|
// // ★★★ 新增:调用 GlobalSeamLeveling3 并重新光栅化 ★★★
|
||||||
texture.ApplyGlobalSeamLevelingOnRCPatches(
|
// texture.ApplyGlobalSeamLevelingOnRCPatches(
|
||||||
virtualFaceMap,
|
// virtualFaceMap,
|
||||||
textures.back(), // atlas
|
// textures.back(), // atlas
|
||||||
nTextureSizeMultiple); // textureSize
|
// nTextureSizeMultiple); // textureSize
|
||||||
|
|
||||||
mesh.texturesDiffuse = std::move(textures);
|
mesh.texturesDiffuse = std::move(textures);
|
||||||
DEBUG_EXTRA("Existing UV texturing completed: %u faces (%s)",
|
DEBUG_EXTRA("Existing UV texturing completed: %u faces (%s)",
|
||||||
|
|||||||
Reference in new issue
Block a user