修改后处理
This commit is contained in:
parent
8e01d63c7a
commit
39a2e4583f
@ -14,17 +14,6 @@ class MergePly:
|
|||||||
|
|
||||||
def merge_grid_laz(self, grid_points: Dict[tuple, pd.DataFrame]):
|
def merge_grid_laz(self, grid_points: Dict[tuple, pd.DataFrame]):
|
||||||
"""合并所有网格的点云数据"""
|
"""合并所有网格的点云数据"""
|
||||||
if len(grid_points) == 1:
|
|
||||||
grid_id = list(grid_points.keys())[0]
|
|
||||||
shutil.copy2(os.path.join(self.output_dir,
|
|
||||||
f"grid_{grid_id[0]}_{grid_id[1]}",
|
|
||||||
"project",
|
|
||||||
"odm_georeferencing",
|
|
||||||
"odm_georeferenced_model.laz"),
|
|
||||||
os.path.join(self.output_dir,
|
|
||||||
"pointcloud.laz")
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 获取所有点云文件路径
|
# 获取所有点云文件路径
|
||||||
laz_files = []
|
laz_files = []
|
||||||
|
@ -240,12 +240,15 @@ class MergeObj:
|
|||||||
# 计算新的尺寸(长宽各变为1/4)
|
# 计算新的尺寸(长宽各变为1/4)
|
||||||
new_size = (img.shape[1] // 4, img.shape[0] // 4)
|
new_size = (img.shape[1] // 4, img.shape[0] // 4)
|
||||||
# 使用双三次插值进行下采样
|
# 使用双三次插值进行下采样
|
||||||
resized_img = cv2.resize(img, new_size, interpolation=cv2.INTER_CUBIC)
|
resized_img = cv2.resize(
|
||||||
|
img, new_size, interpolation=cv2.INTER_CUBIC)
|
||||||
# 保存压缩后的图像
|
# 保存压缩后的图像
|
||||||
if file.lower().endswith('.png'):
|
if file.lower().endswith('.png'):
|
||||||
cv2.imwrite(dst_path, resized_img, [cv2.IMWRITE_PNG_COMPRESSION, 9])
|
cv2.imwrite(dst_path, resized_img, [
|
||||||
|
cv2.IMWRITE_PNG_COMPRESSION, 9])
|
||||||
else:
|
else:
|
||||||
cv2.imwrite(dst_path, resized_img, [cv2.IMWRITE_JPEG_QUALITY, 95])
|
cv2.imwrite(dst_path, resized_img, [
|
||||||
|
cv2.IMWRITE_JPEG_QUALITY, 95])
|
||||||
else:
|
else:
|
||||||
self.logger.warning(f"无法读取图像文件: {src_path}")
|
self.logger.warning(f"无法读取图像文件: {src_path}")
|
||||||
shutil.copy2(src_path, dst_path)
|
shutil.copy2(src_path, dst_path)
|
||||||
@ -289,16 +292,6 @@ class MergeObj:
|
|||||||
|
|
||||||
def merge_grid_obj(self, grid_points: Dict[tuple, pd.DataFrame], translations: Dict[tuple, tuple]):
|
def merge_grid_obj(self, grid_points: Dict[tuple, pd.DataFrame], translations: Dict[tuple, tuple]):
|
||||||
"""合并所有网格的OBJ模型"""
|
"""合并所有网格的OBJ模型"""
|
||||||
if len(grid_points) == 1:
|
|
||||||
grid_id = list(grid_points.keys())[0]
|
|
||||||
shutil.copytree(os.path.join(self.output_dir,
|
|
||||||
f"grid_{grid_id[0]}_{grid_id[1]}",
|
|
||||||
"project",
|
|
||||||
"odm_texturing"),
|
|
||||||
os.path.join(self.output_dir, "texturing"))
|
|
||||||
os.rename(os.path.join(self.output_dir, "texturing", "odm_textured_model_geo.obj"),
|
|
||||||
os.path.join(self.output_dir, "texturing", "textured_model.obj"))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 创建输出目录
|
# 创建输出目录
|
||||||
output_model_dir = os.path.join(self.output_dir, "texturing")
|
output_model_dir = os.path.join(self.output_dir, "texturing")
|
||||||
|
@ -106,17 +106,6 @@ class MergeTif:
|
|||||||
|
|
||||||
self.logger.info(f"开始合并{product_name}")
|
self.logger.info(f"开始合并{product_name}")
|
||||||
|
|
||||||
if len(grid_points) < 2:
|
|
||||||
grid_id = list(grid_points.keys())[0]
|
|
||||||
shutil.copy2(os.path.join(self.output_dir,
|
|
||||||
f"grid_{grid_id[0]}_{grid_id[1]}",
|
|
||||||
"project",
|
|
||||||
product_path,
|
|
||||||
filename),
|
|
||||||
os.path.join(self.output_dir,
|
|
||||||
product_info['output'])
|
|
||||||
)
|
|
||||||
|
|
||||||
input_tif1, input_tif2 = None, None
|
input_tif1, input_tif2 = None, None
|
||||||
merge_count = 0
|
merge_count = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user