You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求指导:如何在Agisoft Python API 1.8.5中添加GCP点(标记)

Agisoft Python API 1.8.5 添加GCP点(标记)方法

核心步骤代码示例

以下是添加GCP点的完整流程,可根据实际场景调整参数:

import Metashape

# 获取当前处理的Chunk
chunk = Metashape.app.document.chunk

# 1. 设置Chunk的坐标系(需与GCP坐标匹配,示例为WGS84)
chunk.crs = Metashape.CoordinateSystem("EPSG:4326")

# 2. 创建新的Marker(GCP)
gcp_marker = chunk.markers.add()

# 3. 配置GCP的地理参考坐标(替换为实际经纬度/海拔)
gcp_marker.reference.location = Metashape.Vector([116.397, 39.908, 50.0])
gcp_marker.reference.enabled = True  # 启用参考坐标
gcp_marker.type = Metashape.Marker.Type.GroundControl  # 指定为地面控制点

# 4. 为GCP关联图像中的像素位置(可选,若需要图像对应标记)
# 选中目标相机(示例取第一个相机)
target_camera = chunk.cameras[0]
# 设置该相机中的像素坐标(x,y为图像内的像素位置)
gcp_marker.projections[target_camera] = Metashape.Marker.Projection(Metashape.Vector([1200, 800]), True)

# 5. 保存文档
Metashape.app.document.save()

关键参数说明

  • chunk.crs:必须设置为与GCP坐标一致的坐标系,常用如EPSG:4326(WGS84经纬度)、EPSG:3857(Web墨卡托)等。
  • marker.reference.location:接受Metashape.Vector类型参数,顺序需匹配坐标系(如经纬度坐标系为[经度, 纬度, 海拔])。
  • marker.projections[camera]:为GCP绑定图像中的像素位置,第二个参数True表示该投影点有效,会参与计算。
  • marker.type:除GroundControl外,还可设置为CheckPoint(检查点)。

内容的提问来源于stack exchange,提问作者PRAJAKTA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 12:57:15