用python生成无人机影像的正射影像、数字高程模型以及三维建模

您所在的位置:网站首页 航拍图片生成模型软件叫什么 用python生成无人机影像的正射影像、数字高程模型以及三维建模

用python生成无人机影像的正射影像、数字高程模型以及三维建模

2024-07-14 03:18:00| 来源: 网络整理| 查看: 265

OpenDroneMap

  OpenDroneMap 是一个开源的航拍图像处理工具,可以把航拍图像进行点云、正射影像和高程模型等处理,也可以做3维重构,生成3维模型。简直是个神器,做出来的效果和pix4d等软件差不多(我目前只做了无人机影像的正摄影像的生成)。   根据官方文档所说,PyODM可以很轻易的创建无人机影像的正射图,DEM,3d模型以及点云。   正射图的效果如下: 在这里插入图片描述   下面开始使用OpenDroneMap的python库PyODM。   注:若图片内有exif信息,则odm可以直接生成tif的正射影像。给图片添加exif信息可以参看下面这篇博客。 https://blog.csdn.net/weixin_43162240/article/details/103579657

1.环境准备 安装pyodm包

  用pip安装即可。

pip install -U pyodm 启动docker

pyodm需要启动docker,所以在使用之前还需要先安装docker. windows的安装就不说了,可以自行百度,下面介绍linux系统下docker的安装。

# 安装docker $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo apt-get install -y docker-ce # 启动docker,这里会自己下载需要的包,所以需要等待一会儿。 $ sudo docker run -ti -p 3000:3000 opendronemap/nodeodm 2.python教程

  大致流程是这样,先连接Node,然后新建任务,然后等待任务执行完成,最后获取结果。   这里关键是新建任务时有个option选项,可以设置一些配置。看文档说明得知,配置会影响处理速度与结果的质量。   对正射影像的制作来说,需要配置的一些参数(参数可以在官方文档查看)如下:

orthophoto-resolution:米/像素,表示地面分辨率dsm:是否要生成dsm,如果不需要的话,选false会加快处理速度ignore-gsd:设置为True就会跳过一些加速处理,得到的图像质量会好一些min-num-features:找的特征点数量,数量越多质量越好,处理时间越长texturing-nadir-weight:官方建议,在都市设为29-32,草地或者平底设置为0-6mesh-octree-depth:官方建议设置为10-11,增加建筑屋顶的平滑性。

  注意:在制作正射影像时,选择的图片最好是有至少两个轨道的数据,一个航线的数据拼接会失败,即task.wait_for_completion()会返回failed.

import os from pyodm import Node import time from tqdm import tqdm image_dir = 'testdata/' result_path = image_dir.split('/')[0]+'_results' ip = 'xxx.xx.xx.xx' # 改为自己的ip port = 3000 start = time.time() images_name = os.listdir(image_dir) images_name = [image_dir+image_name for image_name in images_name] print(images_name) n = Node(ip, port) print("Node连接成功,{}张图开始处理".format(len(images_name))) task = n.create_task(images_name, {'orthophoto-resolution': 0.0274,"min-num-features":35000}) print("任务创建完成") pbar = tqdm(total=100) processing = 0 while True: info = task.info() if info.progress==100: break pbar.update(info.progress-processing) processing = info.progress if info.last_error!='': print("error ", info.last_error) time.sleep(0.1) pbar.close() print("处理完成") # task.wait_for_completion() task.download_assets(result_path) print("{}张图消耗{}秒".format(len(images_name), time.time() - start)) 3.其它

  查看官方文档可能需要科学上网,所以把option列出来了。

-h, --help show this help message and exit --images , -i Path to input images --project-path Path to the project folder --resize-to resizes images by the largest side for opensfm. Set to -1 to disable. Default: 2048 --end-with , -e Can be one of:dataset | split | merge | opensfm | mve | odm_filterpoints | odm_meshing | mvs_texturing | odm_georeferencing | odm_dem | odm_orthophoto --rerun , -r Can be one of:dataset | split | merge | opensfm | mve | odm_filterpoints | odm_meshing | mvs_texturing | odm_georeferencing | odm_dem | odm_orthophoto --rerun-all force rerun of all tasks --rerun-from Can be one of:dataset | split | merge | opensfm | mve | odm_filterpoints | odm_meshing | mvs_texturing | odm_georeferencing | odm_dem | odm_orthophoto --proj Projection used to transform the model into geographic coordinates --min-num-features Minimum number of features to extract per image. More features leads to better results but slower execution. Default: 8000 --matcher-neighbors Number of nearest images to pre-match based on GPS exif data. Set to 0 to skip pre-matching. Neighbors works together with Distance parameter, set both to 0 to not use pre-matching. OpenSFM uses both parameters at the same time, Bundler uses only one which has value, prefering the Neighbors parameter. Default: 8 --matcher-distance Distance threshold in meters to find pre-matching images based on GPS exif data. Set both matcher- neighbors and this to 0 to skip pre-matching. Default: 0 --use-fixed-camera-params Turn off camera parameter optimization during bundler Off by default unless --camera parameter used --camera-lens Can be one of auto | perspective | brown | fisheye | spherical Set a camera projection type. Manually setting a value can help improve geometric undistortion. By default the application tries to determine a lens type from the images metadata. Default: auto --max-concurrency The maximum number of processes to use in various processes. Peak memory requirement is ~1GB per thread and 2 megapixel image resolution. Default: number of cores --depthmap-resolution Controls the density of the point cloud by setting the resolution of the depthmap images. Higher values take longer to compute and more memory but produce denser point clouds. Default: 640 --opensfm-depthmap-min-consistent-views


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭