当前位置:网站首页>Part 67: conversion between keypoint and point2f in opencv
Part 67: conversion between keypoint and point2f in opencv
2022-07-25 23:46:00 【Liao Jiacai】
author :liaojiacai
mailbox : [email protected]
opencv When detecting the middle diagonal point, you need to vector<KeyPoint> And vector<point2f> Switch between
This is in opencv The version comes with related conversion functions
1、KeyPoint turn point2f
CV_WRAP static void convert(const std::vector<KeyPoint>& keypoints, CV_OUT std::vector<Point2f>& points2f, const std::vector<int>& keypointIndexes=std::vector<int>());Using examples :
KeyPoint::convert(keypoints,point2f, 1, 1, 0, -1);
2、point2f turn KeyPoint
CV_WRAP static void convert(const std::vector<Point2f>& points2f, CV_OUT std::vector<KeyPoint>& keypoints, float size=1, float response=1, int octave=0, int class_id=-1);Using examples :
KeyPoint::convert(point2f, keypoint, 1, 1, 0, -1);
See from above : The names of these two conversion functions are the same , So it's overloaded , The input parameters have different sequences and functions
in addition , According to your own needs , Use the conversion function written by yourself to convert KeyPoint To Point
Next, write your own conversion function according to the reference :
void KeyPointsToPoints(vector<KeyPoint> kpts, vector<Point2f> &pts) { for (int i = 0; i < kpts.size(); i++) { pts.push_back(kpts[i].pt); } }void PointsToKeyPoints(vector<Point2f>pts,vector<KeyPoint>kpts) { for (size_t i = 0; i < pts.size(); i++) { kpts.push_back(KeyPoint(pts[i], 1.f)); } } Reference resources :How can I convert vector<Point2f> to vector<KeyPoint>? - OpenCV Q&A Forum
http://answers.opencv.org/question/24623/how-can-i-convert-vectorpoint2f-to-vectorkeypoint/
边栏推荐
- 【MUDUO】EventLoopThreadPool
- Loading process such as reflection
- VSCode格式化Json文件
- LeetCode 0135. 分发糖果
- 【MUDUO】EventLoopThreadPool
- JS synchronization and asynchrony
- 死信队列 和消息TTL过期代码
- 从哪些维度评判代码质量的好坏?如何具备写出高质量代码的能力?
- Qt风格(QSS)应用之QProgressBar
- Generating random number random learning uniform_ int_ distribution,uniform_ real_ distribution
猜你喜欢

红娘的话

【JUC】并发需要了解的关键字volatile

【代码案例】博客页面设计(附完整源码)
![[JUC] concurrent keyword volatile](/img/80/2f1b33f1e8c87fd4f8806eafb83139.png)
[JUC] concurrent keyword volatile

意向不到的Dubug妙招

Grain Academy p98 trample pit e.globalexceptionhandler: null

Topsis与熵权法

LeetCode 0919. 完全二叉树插入器:完全二叉树的数组表示

chown: changing ownership of ‘/var/lib/mysql/‘: Operation not permitted

Query commodity cases (operate data with array addition method) / key points
随机推荐
【代码案例】博客页面设计(附完整源码)
Same origin strategy and cross domain
【MUDUO】Thread封装
S4/hana mm & SD EDI Nast based integrated configuration (orders, ordrsp, desadv, invoice)
Several ways of writing strings in reverse order
[debug bug] JS: getFullYear is not a function
The process of finding free screen recording software - I didn't expect win10 to come with this function
面试重点——传输层的TCP协议
762. 二进制表示中质数个计算置位
How to solve cross domain problems
152. 乘积最大子数组-动态规划
新手开户选择哪个券商公司好呢?安全吗
R language installation tutorial | graphic introduction is super detailed
152. Product maximum subarray - dynamic programming
Wrote a little webapi knowledge points from 0 to 1
Docker 安装 Redis-5.0.12(远程访问)
[testing technology automated testing pytest] basic summary of pytest
Regular expression (user name form verification / verification of landline number / regular replacement)
[JUC] concurrent keyword volatile
[Database Foundation] summary of MySQL Foundation