当前位置:网站首页>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矩阵,以便实现以下计算:
边栏推荐
- [微服务]多级缓存
- 新评论接口——京东评论接口
- 滑动窗口的最大值
- JS get browser type
- 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
- An工具介绍之3D工具
- 字节最爱问的智力题,你会几道?
- 【深度学习】高效轻量级语义分割综述
- Graphic animation and button animation of an animation basic component
- An animation basic element movie clip effect
猜你喜欢
An工具介绍之摄像头
[Blue Bridge Cup Trial Question 48] Scratch Dance Machine Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
[R] Use grafify for statistical plotting, ANOVA, intervention comparisons, and more!
The common problems in the futures account summary
Image fusion GAN-FM study notes
setTimeout 、setInterval、requestAnimationFrame
漫画:怎么证明sleep不释放锁,而wait释放锁?
An introduction to the skeleton tool
An animation optimization of traditional guide layer animation
易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
随机推荐
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
浅谈低代码平台远程组件加载方案
AMS simulation
[Blue Bridge Cup Trial Question 48] Scratch Dance Machine Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
Golang sync.WaitGroup
来广州找工作有一个多月了,今天终于有着落了,工资7000
类和对象(中上)
[Deep Learning] Overview of Efficient and Lightweight Semantic Segmentation
【实战技能】单片机bootloader的CANFD,I2C,SPI和串口方式更新APP视频教程(2022-08-01)
Nodejs 安装依赖cpnm时,install 出现Error: Cannot find module ‘fs/promises‘
使用 %Status 值
Comics: how do you prove that sleep does not release the lock, and wait to release lock?
Chapter 15 Source Code File REST API Introduction
五、函数的调用过程
An工具介绍之摄像头
使用工作队列管理器(三)
An动画基础之按钮动画与基础代码相结合
Graphic animation and button animation of an animation basic component
Jmeter use