当前位置: 首页 > wzjs >正文

上海门户网站论坛怎么推广

上海门户网站论坛,怎么推广,做淘宝美工需要知道的网站,茂名企业建站模板操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 算法描述 cv::detail::findMaxSpanningTree 是 OpenCV 中用于图像拼接工作流的一个函数,它帮助构建一个最大生成树(Maximum Spanni…
  • 操作系统:ubuntu22.04
  • OpenCV版本:OpenCV4.9
  • IDE:Visual Studio Code
  • 编程语言:C++11

算法描述

cv::detail::findMaxSpanningTree 是 OpenCV 中用于图像拼接工作流的一个函数,它帮助构建一个最大生成树(Maximum Spanning Tree),这在图像拼接中用于确定图像之间的最佳连接方式。这个函数特别适用于处理多个图像间的匹配信息,并基于这些信息来构建一个图结构,从而为后续的图像拼接步骤提供基础。

函数原型

void cv::detail::findMaxSpanningTree 	
(int  	num_images,const std::vector< MatchesInfo > &  	pairwise_matches,Graph &  	span_tree,std::vector< int > &  	centers ) 	

参数

  • num_images: 图像的数量。
  • pairwise_matches: 包含每对图像之间匹配信息的向量。每个 MatchesInfo 结构体包含了两个图像之间的匹配点、置信度等信息。
  • span_tree: 输出参数,表示由函数计算得到的最大生成树。这个图结构描述了如何以最优的方式将所有图像连接起来。
  • centers: 输出参数,包含可能作为拼接中心的图像索引列表。在全景拼接中,通常选择一个或几个中心图像来开始拼接过程。

代码示例

#include <opencv2/opencv.hpp>
#include <opencv2/stitching/detail/matchers.hpp>
#include <opencv2/stitching/detail/util.hpp>#include <iostream>
#include <vector>using namespace cv;
using namespace cv::detail;int main() {// 加载图像(此处仅作示意,实际应用中需要加载真实图像)std::vector<std::string> img_filenames = {"/media/dingxin/data/study/OpenCV/sources/images/left01.jpg","/media/dingxin/data/study/OpenCV/sources/images/right01.jpg","/media/dingxin/data/study/OpenCV/sources/images/right01.jpg"};std::vector<cv::Mat> imgs;for (const auto& filename : img_filenames) {cv::Mat img = cv::imread(filename);if (img.empty()) {std::cerr << "无法加载图像: " << filename << std::endl;return -1;}imgs.push_back(img);}// 初始化特征检测器和描述符提取器Ptr<Feature2D> detector = ORB::create();BestOf2NearestMatcher matcher(false, 0.3f);// 计算每张图像的特征点std::vector<ImageFeatures> features(imgs.size());for (size_t i = 0; i < imgs.size(); ++i) {detector->detectAndCompute(imgs[i], Mat(), features[i].keypoints, features[i].descriptors);}// 匹配特征点std::vector<MatchesInfo> pairwise_matches;matcher(features, pairwise_matches);// 构建最大生成树Graph span_tree;std::vector<int> centers;findMaxSpanningTree(imgs.size(), pairwise_matches, span_tree, centers);// 打印中心图像索引std::cout << "Centers: ";for (int center : centers) {std::cout << center << " ";}std::cout << std::endl;// 手动重建最大生成树的边std::vector<bool> visited(imgs.size(), false);for (int center : centers) {std::cout << "Starting from center: " << center << std::endl;visited[center] = true;for (size_t i = 0; i < pairwise_matches.size(); ++i) {const MatchesInfo& match_info = pairwise_matches[i];if (match_info.confidence > 0 && !visited[match_info.src_img_idx] && !visited[match_info.dst_img_idx]) {std::cout << "(" << match_info.src_img_idx << ", " << match_info.dst_img_idx << ")" << std::endl;visited[match_info.src_img_idx] = true;visited[match_info.dst_img_idx] = true;}}}return 0;
}

运行结果

Centers: 2 
Starting from center: 2
(0, 1)
http://www.dtcms.com/wzjs/265586.html

相关文章:

  • 查企业信息的app长沙企业关键词优化哪家好
  • 哈尔滨 做网站公司哪家好官网建设
  • 没有相应营业执照怎么做网站十八大禁用黄app入口
  • 做网站需要会编程吗关键词搜索爱站
  • 建网站需要哪些文件夹淘宝推广
  • 织梦做淘宝客网站视频教程宁波seo关键词优化制作
  • 北京免费网站建设模板适合网络营销的产品
  • wordpress评论后不显示网站seo分析工具
  • 经纪人做网站技巧企业管理培训课程网课
  • 郑州门户网站建设seo标题生成器
  • 网站建设产品图合肥全网推广
  • 怎么做自己网站的API教你如何建立网站
  • 买衣服网站排名网站首页布局设计模板
  • 中国建设银行网站个人客户官网人民网 疫情
  • 宁波网站建设价格费用下拉关键词排名
  • 网站特殊字体苏州疫情最新通知
  • 公司网站建设介绍百度浏览器网址大全
  • 和优网站建设搜索引擎的使用方法和技巧
  • 凡客做网站怎么样市场营销案例分析及解答
  • 做网站分几个步骤网站搭建关键词排名
  • 乡镇门户网站建设的现状及发展对策广告联盟app下载
  • 没有平台没有网站怎么做外贸网站推广优化排名
  • 网站设计论文前言电商运营主要负责什么
  • 怎么下载网站备案号广西网站seo
  • 构建电子商务网站的步骤抖音关键词排名优化
  • PS做任务的网站扬中网站制作
  • 婚纱手机网站制作微信软文范例100字
  • 百度百科网站怎么做磐石网站seo
  • david网站如何做go通路图产品故事软文案例
  • 成品网站建设咨询合肥关键词排名优化