当前位置:网站首页>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矩阵,以便实现以下计算:
边栏推荐
- IronOS, an open source system for portable soldering irons, supports a variety of portable DC, QC, PD powered soldering irons, and supports all standard functions of smart soldering irons
- 欧曼自动挡、银河大马力、行星新产品 欧曼全新产品以燎原之势赢领市场
- Image fusion GAN-FM study notes
- Feature Engineering Study Notes
- leetcode 11. The container that holds the most water
- Random forest project combat - temperature prediction
- Notepad++ install jsonview plugin
- PyTorch框架训练线性回归模型(CPU与GPU环境)
- 图像融合GAN-FM学习笔记
- [Deep Learning] Overview of Efficient and Lightweight Semantic Segmentation
猜你喜欢
力扣刷题 每日两题(一)
【深度学习】高效轻量级语义分割综述
Basic principle of the bulk of the animation and shape the An animation tip point
Win11怎么禁止软件后台运行?Win11系统禁止应用在后台运行的方法
Jmeter使用
Real number rounding and writing to file (C language file)
Key points for account opening of futures companies
PyTorch框架训练线性回归模型(CPU与GPU环境)
An introduction to the camera
leetcode16最接近的三数之和 (排序+ 双指针)
随机推荐
php microtime encapsulates the tool class, calculates the running time of the interface (breakpoint)
YOLOv5 training data prompts No labels found, with_suffix is used, WARNING: Ignoring corrupted image and/or label appears during yolov5 training
【R】用grafify搞定统计绘图、方差分析、干预比较等!
Image fusion SDDGAN article learning
层次分析法
PolarFormer: Multi-camera 3D Object Detection with Polar Transformers 论文笔记
PyTorch构建分类网络模型(Mnist数据集,全连接神经网络)
图像融合DDcGAN学习笔记
15. PARTITIONS「建议收藏」
云计算服务主要安全风险及应对措施初探
An introduction to the camera
HCIP 第十六天笔记(SVI、生成树协议)
有趣的opencv-记录图片二值化和相似度实现
Oracle is installed (system disk) and transferred from the system disk to the data disk
An introduction to basic tools for selecting line tools (package church)
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?
图像融合GAN-FM学习笔记
基于php家具销售管理系统获取(php毕业设计)
超多精美礼品等你来拿!2022年中国混沌工程调查启动
Last blog for July