@ -39,6 +39,8 @@
@@ -39,6 +39,8 @@
# include <pybind11/embed.h>
# include <pybind11/stl.h>
# include "ConfigEnv.h"
namespace py = pybind11 ;
using namespace MVS ;
@ -8598,7 +8600,8 @@ bool Scene::LoadVisibleFacesData(std::map<std::string, std::unordered_set<int>>&
@@ -8598,7 +8600,8 @@ bool Scene::LoadVisibleFacesData(std::map<std::string, std::unordered_set<int>>&
// - nIgnoreMaskLabel: label value to ignore in the image mask, stored in the MVS scene or next to each image with '.mask.png' extension (-1 - auto estimate mask for lens distortion, -2 - disabled)
bool Scene : : TextureMesh ( unsigned nResolutionLevel , unsigned nMinResolution , unsigned minCommonCameras , float fOutlierThreshold , float fRatioDataSmoothness ,
bool bGlobalSeamLeveling , bool bLocalSeamLeveling , unsigned nTextureSizeMultiple , unsigned nRectPackingHeuristic , Pixel8U colEmpty , float fSharpnessWeight ,
int nIgnoreMaskLabel , int maxTextureSize , const IIndexArr & views , const SEACAVE : : String & baseFileName , bool bOriginFaceview )
int nIgnoreMaskLabel , int maxTextureSize , const IIndexArr & views , const SEACAVE : : String & baseFileName , bool bOriginFaceview ,
const std : : string & inputFileName , const std : : string & meshFileName )
{
if ( ! bOriginFaceview )
{
@ -8624,7 +8627,7 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
@@ -8624,7 +8627,7 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
MeshTexture texture ( * this , nResolutionLevel , nMinResolution ) ;
printf ( " baseFileName=%s \n " , baseFileName . c_str ( ) ) ;
// printf("baseFileName=%s\n", baseFileName.c_str());
/*
std : : filesystem : : path path ( baseFileName . c_str ( ) ) ;
@ -8668,6 +8671,39 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
@@ -8668,6 +8671,39 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
# ifdef MASK_FACE_OCCLUSION
/*
// 创建遮挡数据
std : : cout < < " inputFileName: " < < inputFileName < < std : : endl ;
std : : cout < < " meshFileName: " < < meshFileName < < std : : endl ;
try {
py : : scoped_interpreter guard { } ; // 自动管理解释器生命周期
py : : module_ sys = py : : module_ : : import ( " sys " ) ;
// 设置命令行参数(模拟Python的argparse)
py : : list argv ;
argv . append ( " program_name " ) ;
argv . append ( " --sparse_dir " ) ;
argv . append ( static_cast < std : : string > ( inputFileName ) ) ;
argv . append ( " --mesh_path " ) ;
argv . append ( static_cast < std : : string > ( meshFileName ) ) ;
// argv.append("--mask_image");
// argv.append("63_2");
sys . attr ( " argv " ) = argv ;
py : : print ( sys . attr ( " version " ) ) ; // 打印Python版本
sys . attr ( " path " ) . attr ( " append " ) ( " /root/miniconda3/lib/python3.10/site-packages " ) ;
sys . attr ( " path " ) . attr ( " append " ) ( " /root/code/openMVS/libs/MVS " ) ;
// 调用自定义函数
py : : module_ mymodule = py : : module_ : : import ( " mask_face_occlusion " ) ;
// 获取ModelProcessor类
py : : object ModelProcessor = mymodule . attr ( " ModelProcessor " ) ;
py : : object processor = ModelProcessor ( ) ;
py : : dict result = processor . attr ( " process " ) ( ) . cast < py : : dict > ( ) ;
printf ( " result size=%d \n " , result . size ( ) ) ;
*/
std : : string basePath = " " ;
size_t lastSlash = baseFileName . find_last_of ( ' / ' ) ;
size_t secondLastSlash = baseFileName . find_last_of ( ' / ' , lastSlash - 1 ) ;
@ -8693,13 +8729,22 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
@@ -8693,13 +8729,22 @@ bool Scene::TextureMesh(unsigned nResolutionLevel, unsigned nMinResolution, unsi
argv . append ( " --id " ) ;
// argv.append("274658"); // 274658 7613212046
argv . append ( id ) ;
// argv.append("--mask_image");
// argv.append("63_2");
argv . append ( " --base_path " ) ;
argv . append ( basePath . c_str ( ) ) ;
argv . append ( " --mesh_path " ) ;
argv . append ( meshFileName . c_str ( ) ) ;
argv . append ( " --sparse_dir " ) ;
argv . append ( inputFileName . c_str ( ) ) ;
sys . attr ( " argv " ) = argv ;
py : : print ( sys . attr ( " version " ) ) ; // 打印Python版本
sys . attr ( " path " ) . attr ( " append " ) ( " /home/algo/.conda/envs/py310_pyt210/lib/python3.10/site-packages " ) ;
sys . attr ( " path " ) . attr ( " append " ) ( " /home/algo/Documents/openMVS/openMVS/libs/MVS " ) ;
printf ( " PYTHON_PATH=%s \n " , PYTHON_PATH . c_str ( ) ) ;
printf ( " MVS_PATH=%s \n " , MVS_PATH . c_str ( ) ) ;
// sys.attr("path").attr("append")("/home/algo/.conda/envs/py310_pyt210/lib/python3.10/site-packages");
// sys.attr("path").attr("append")("/home/algo/Documents/openMVS/openMVS/libs/MVS");
sys . attr ( " path " ) . attr ( " append " ) ( PYTHON_PATH . c_str ( ) ) ;
sys . attr ( " path " ) . attr ( " append " ) ( MVS_PATH . c_str ( ) ) ;
// 调用自定义函数
py : : module_ mymodule = py : : module_ : : import ( " mask_face_occlusion " ) ;