单应性变换(Homography)
来源:互联网 发布:怎样申请淘宝店 编辑:程序博客网 时间:2024/05/19 02:00
概要:
来源:http://www.learnopencv.com/homography-examples-using-opencv-python-c/
单应性变换就是一个平面到另一个平面的映射关系。
如图,两张图片中相同颜色的点叫做corresponding Points,比如两个红点就是一对corresponding points。单应性矩阵(Homography)就是一个从一张图像到另一张图像映射关系的转换矩阵(3*3)。可以由下面的公式来表示:
以图像中的红点为例,可以将单应性变换写成如下形式:
Python实现:
import cv2import numpy as npimport pylab as pl if __name__ == '__main__' : # Read source image. im_src = cv2.imread('book2.jpg') # Four corners of the book in source image pts_src = np.array([[167.0, 264.0], [482.0, 798.0], [1079.0, 403.0],[613.0, 84.0]]) # Read destination image. im_dst = cv2.imread('book1.jpg') # Four corners of the book in destination image. pts_dst = np.array([[193.0, 742.0],[996.0, 874.0],[1059.0, 157.0],[266.0, 145.0]]) # Calculate Homography h, status = cv2.findHomography(pts_src, pts_dst) # Warp source image to destination based on homography im_out = cv2.warpPerspective(im_src, h, (im_dst.shape[1],im_dst.shape[0])) pl.figure(), pl.imshow(im_src[:, :, ::-1]), pl.title('src'), pl.figure(), pl.imshow(im_dst[:, :, ::-1]), pl.title('dst') pl.figure(), pl.imshow(im_out[:, :, ::-1]), pl.title('out'), pl.show() #show dst结果:
0 0
- 单应性变换(Homography)
- 单应性变换(Homography)
- 单应性(homography)变换的推导
- 单应性(homography)变换的公式推导过程
- Opencv homography及其变换
- homography单应性求解
- Homography
- Homography单应性矩阵程序实现
- Homography,opencv,单应性矩阵的计算原理
- 关于单应性矩阵的理解:Homography matrix for dummies
- 【Graph】Homography
- Opencv日常之Homography
- Homography单应矩阵
- Features2D + Homography物体识别
- Homography estimation实现
- Homography 知多少?
- Homography单应矩阵
- Opencv中Homography
- jdbc pstmt.executeQuery() 程序中断引起的问题(数据库postgrelsql)
- 微信小程序 扫一扫
- 如何避免block循环引用
- Prometheus 实战于源码分析之webHandler
- 数据结构—栈
- 单应性变换(Homography)
- PHP设计模式系列(一):策略模式
- 除了cocoapods导入工程中以外的方法,尤其针对直接拖拽到工程里报错的三方库
- Java多线程/并发01、新建线程的3种方法
- hdu 5128 The E-pang Palace(几何暴力)
- 解决GAT项目Bug:ETC费用统计问题
- 冒泡算法和交换算法
- ToolBar初步
- 输出eclipse控制台日志到指定目录