You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
4.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <pybind11/stl.h> // 用于绑定 std::string 等
#include "StitchStruct.h" // 包含 API_UnderStitch 的定义
#include "API_UnderStitch.h"
// =========================================================================
// 2. PYBIND11 绑定代码
// =========================================================================
#include <pybind11/pybind11.h>
namespace py = pybind11;
// 辅助函数:只负责绑定所有公用结构体
void bind_public_structures(py::module_ &m) {
// PointBLH
py::class_<PointBLH>(m, "PointBLH", "地理坐标系,单位:度")
.def(py::init<>())
.def_readwrite("B", &PointBLH::B, "纬度")
.def_readwrite("L", &PointBLH::L, "经度")
.def_readwrite("H", &PointBLH::H, "高程");
// EulerRPY
py::class_<EulerRPY>(m, "EulerRPY", "RPY 姿态角,单位:度")
.def(py::init<>())
.def_readwrite("fRoll", &EulerRPY::fRoll, "横滚角")
.def_readwrite("fPitch", &EulerRPY::fPitch, "俯仰角")
.def_readwrite("fYaw", &EulerRPY::fYaw, "方位角");
// ----------------------------------------------------
// B. 嵌套结构体
// ----------------------------------------------------
// AirCraftInfo
py::class_<AirCraftInfo>(m, "AirCraftInfo", "载体信息")
.def(py::init<>())
.def_readwrite("nPlaneID", &AirCraftInfo::nPlaneID, "载机ID")
.def_readwrite("stPos", &AirCraftInfo::stPos, "位置 (PointBLH)")
.def_readwrite("stAtt", &AirCraftInfo::stAtt, "姿态 (EulerRPY)");
// CamInfo
py::class_<CamInfo>(m, "CamInfo", "相机信息")
.def(py::init<>())
.def_readwrite("nFocus", &CamInfo::nFocus, "实时焦距值")
.def_readwrite("fPixelSize", &CamInfo::fPixelSize, "像素尺寸")
.def_readwrite("unVideoType", &CamInfo::unVideoType, "视频源类型")
.def_readwrite("dCamx", &CamInfo::dCamx, "像主点偏移x")
.def_readwrite("dCamy", &CamInfo::dCamy, "像主点偏移y")
.def_readwrite("fAglReso", &CamInfo::fAglReso, "角分辨率");
// ServoInfo
py::class_<ServoInfo>(m, "ServoInfo", "伺服状态")
.def(py::init<>())
.def_readwrite("fServoAz", &ServoInfo::fServoAz, "当前帧伺服方位角")
.def_readwrite("fServoPt", &ServoInfo::fServoPt, "当前帧伺服俯仰角")
.def_readwrite("fServoAzSpeed", &ServoInfo::fServoAzSpeed, "当前帧伺服方位角速度")
.def_readwrite("fServoPtSpeed", &ServoInfo::fServoPtSpeed, "当前帧伺服俯仰角速度");
// ----------------------------------------------------
// C. FrameInfo 和 UPanInfo
// ----------------------------------------------------
// FrameInfo
py::class_<FrameInfo>(m, "FrameInfo", "帧内外方位元素")
.def(py::init<>())
.def_readwrite("nFrmID", &FrameInfo::nFrmID, "帧编号唯一ID")
.def_readwrite("craft", &FrameInfo::craft, "载体信息 (AirCraftInfo)")
.def_readwrite("camInfo", &FrameInfo::camInfo, "相机信息 (CamInfo)")
.def_readwrite("servoInfo", &FrameInfo::servoInfo, "伺服状态 (ServoInfo)")
.def_readwrite("nEvHeight", &FrameInfo::nEvHeight, "相对高差")
.def_readwrite("nWidth", &FrameInfo::nWidth, "图像宽度")
.def_readwrite("nHeight", &FrameInfo::nHeight, "图像高度");
// UPanInfo
py::class_<UPanInfo>(m, "UPanInfo", "下视全景图配置")
.def(py::init<>())
.def_readwrite("m_pan_width", &UPanInfo::m_pan_width, "全景图宽度")
.def_readwrite("m_pan_height", &UPanInfo::m_pan_height, "全景图高度")
.def_readwrite("scale", &UPanInfo::scale, "比例尺")
.def_readwrite("map_shiftX", &UPanInfo::map_shiftX, "平移X")
.def_readwrite("map_shiftY", &UPanInfo::map_shiftY, "平移Y");
// UPanConfig
py::class_<UPanConfig>(m, "UPanConfig", "下视拼接参数控制")
.def(py::init<>())
.def_readwrite("bUseBA", &UPanConfig::bUseBA, "开启BA")
.def_readwrite("bOutFrameTile", &UPanConfig::bOutFrameTile, "输出单帧正射图")
.def_readwrite("bOutGoogleTile", &UPanConfig::bOutGoogleTile, "输出谷歌瓦片");
}