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.

82 lines
1.9 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.

// 全局BA
/*********版权所有C2025武汉高德红外股份有限公司***************************************
* 文件名称: Arith_BAProc.h
* 文件标识BA
* 内容摘要:光束平差
* 其它说明:
* 当前版本V0.5
* 创建作者04046wcw
* 创建日期2025/01/15
* 包含关系:
*****************************************************************************************/
#pragma once
#include "FileCache.h"
#include "Arith_FeaMatch.h"
//#define SHOW_MATCH
class BA_Task
{
public:
BA_Task(FileCache<FrameCache>* cache);
~BA_Task();
// 初始化BA任务
void InitTask();
// 优化指定帧并更新H到缓存中,H_map用于优化过程可视化
void OptFrame(vector<KeyType> frameInd, cv::Mat H_map);
// 更新缓存中的帧H矩阵并存储
bool updateCacheH(KeyType Key, cv::Mat H);
private:
// 从缓存读取指定帧信息(不需要图像)
int readFrameInfo(vector<KeyType> frameInd);
// 输出优化结果到cache
int writeFrameInfo();
SINT32 CalMatchMat();//计算匹配性矩阵
// 调试图像
vector<cv::Mat> _imgVec;//图像缓存
vector<KeyType> _frameInd;//帧索引,BA模块按照线性存储完成后利用索引更新实际帧。注意传入的索引有可能是空的需要处理
FeatureMatcher* _FeaMatcher;//特征匹配
FileCache<FrameCache>* _cache;
Mat_<int> _MatchMat;//配准点邻接表
Mat_<float> _IOUMat;//交汇邻接表
vector<cv::Mat_<double>> _origMatrix;//初始H矩阵
vector<cv::Mat_<double>> _currMatrix;//当前H矩阵
vector<vector<cv::Point2f>> _polygon;//帧包围四边形
vector<vector<cv::KeyPoint>> _FeaPtVec;//特征点缓存
vector<cv::Mat> _FeaDespVec;//特征点描述子
vector<FrameInfo> _paraVec;
private:
// 调试:绘制匹配关系
void drawMatch(int i, int j, std::vector<cv::DMatch> match,cv::Mat H_map);
};
void drawPolygons(cv::Mat& image, const std::vector<std::vector<cv::Point2f>>& polygons);