当前位置:网站首页>OpenCV perspective transform
OpenCV perspective transform
2022-08-03 13:14:00 【I this year 16 years old】
目录
一:OpenCV透视变换的概念

仿射变换Based on an image3个固定顶点的变换,接下来学习的透视变换是4个固定顶点的变换
二:透视变换工作原理
透视变换(Perspective Transformation)的本质是将图像投影到一个新的视平面,其通用变换公式为:

(u,v)为原始图像像素坐标,(x=x’/w’,y=y’/w’)为变换之后的图像像素坐标.透视变换矩阵图解如下:

仿射变换(Affine Transformation)可以理解为透视变换的特殊形式.透视变换的数学表达式为:

所以,给定透视变换对应的Four pairs of pixel coordinates,即可求得透视变换矩阵;反之,给定透视变换矩阵,即可对图像或像素点坐标完成透视变换,如下图所示:


三:findHomography函数
findHomography: 计算多个二维点对之间的最优单映射变换矩阵 H(3行x3列) ,使用最小均方误差或者RANSAC方法.
函数功能:找到两个平面之间的变换矩阵.
函数参数:
Mat cv::findHomography ( InputArray srcPoints,
InputArray dstPoints,
int method = 0,
double ransacReprojThreshold = 3,
OutputArray mask = noArray(),
const int maxIters = 2000,
const double confidence = 0.995
)

四:warpPerspective函数
函数原型:
void warpPerspective(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, const Scalar& borderValue=Scalar())
函数参数说明:
Figure in the red dot is the fixed vertex,在变换先后固定顶点的像素值不变,Image as a whole, according to the rules of transformation to transform
同理,透视变换Based on an image4个固定顶点的变换,如图所示:

五:getPerspectiveTransform函数
函数原型:
C++方式一:Mat getPerspectiveTransform(InputArray src, InputArray dst)
C++方式二:Mat getPerspectiveTransform(const Point2f src[], const Point2f dst[])
函数参数说明:
src – 源图像中四边形顶点的坐标
dst – 目标图像中相应四边形顶点的坐标.
该函数计算透视变换的3乘3矩阵,以便实现以下计算:

边栏推荐
猜你喜欢

易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元

有趣的opencv-记录图片二值化和相似度实现

什么是分布式锁?几种分布式锁分别是怎么实现的?

An animation optimization of shape tween and optimization of traditional tweening

An工具介绍之宽度工具、变形工具与套索工具

Jmeter use

Yahoo! Answers-数据集

云计算服务主要安全风险及应对措施初探

In order to counteract the drop in sales and explore the low-end market, Weilai's new brand products are priced as low as 100,000?

基于php旅游网站管理系统获取(php毕业设计)
随机推荐
(through page) ali time to upload the jar
setTimeout 、setInterval、requestAnimationFrame
长江商业银行面试
类和对象(中下)
An animation basic element movie clip effect
图像融合DDcGAN学习笔记
期货开户中常见问题汇总
SQL分页查询_Sql根据某个字段分页
Random forest project combat - temperature prediction
数据库基础知识一(MySQL)[通俗易懂]
基于php家具销售管理系统获取(php毕业设计)
Win11怎么禁止软件后台运行?Win11系统禁止应用在后台运行的方法
2022 年 CISO 最关心的是什么?
Station B responded that "HR said that core users are all Loser": the interviewer was persuaded to quit at the end of last year and will learn lessons to strengthen management
浅谈程序员的职业操守
技术分享 | 接口自动化测试如何搞定 json 响应断言?
Golang GMP 原理
leetcode/字符串中的所有变位词(s1字符串的某个排列是s2的子串)的左索引
self-discipline
8/2 训练日志(dp+思维+字典树)