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.
StitchVideo/stitch/py/API_UnderStitch_binding.cpp

54 lines
1.9 KiB

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "cvbind.hpp" // 包含 cv::Mat 类型转换支持
#include "API_UnderStitch.h"
#include "StitchStruct.h"
namespace py = pybind11;
// 前向声明
void bind_public_structures(py::module_ &m);
// 绑定 API_UnderStitch 类
void bind_API_UnderStitch(py::module_ &m) {
py::class_<API_UnderStitch>(m, "API_UnderStitch", "视频帧下视地理拼接")
.def("Init", &API_UnderStitch::Init,
py::arg("info"),
"初始化拼接")
.def("SetOutput", &API_UnderStitch::SetOutput,
py::arg("name"), py::arg("outdir"),
"设置输出标识和路径")
.def("Run", py::overload_cast<cv::Mat, FrameInfo>(&API_UnderStitch::Run),
py::arg("img"), py::arg("para"),
"运行拼接流程 (cv::Mat版本)")
.def("Stop", &API_UnderStitch::Stop,
"中止拼接流程")
.def("SetConfig", &API_UnderStitch::SetConfig,
py::arg("config"),
"运行参数配置")
.def("OptAndOutCurrPan", &API_UnderStitch::OptAndOutCurrPan,
"立即优化并输出当前全景图")
.def("ExportPanMat", &API_UnderStitch::ExportPanMat,
"获取全景图mat")
.def("getHomography", &API_UnderStitch::getHomography,
py::arg("info"),
"获取单应性矩阵")
.def_static("Create", &API_UnderStitch::Create,
py::arg("cachedir") = "./cache",
"创建 API_UnderStitch 实例")
.def_static("Destroy", &API_UnderStitch::Destroy,
py::arg("obj"),
"销毁 API_UnderStitch 实例");
}
PYBIND11_MODULE(UStitcher, m) {
m.doc() = "下视拼接算法 Python 绑定";
// 先绑定公共结构体
bind_public_structures(m);
// 再绑定 API_UnderStitch 类
bind_API_UnderStitch(m);
}