当前位置:网站首页>初识Opencv4.X----图像透视变换
初识Opencv4.X----图像透视变换
2022-07-26 14:01:00 【F l e】
//图像图像透视变换
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
//图像的透视变换,需要3x3的旋转矩阵,总共9个参数,通过原图像和变换后的对应4个点就可以构造12个方程解出9个参数
Mat img = imread("noobcvqr.png");
//注意边界点不能用,图像为628*628,最大值为627,否则会报错
Point2f src[4] = {
Point2f(94,374),Point2f(507,380),Point2f(1,623) ,Point2f(627,627) };
Point2f dst[4] = {
Point2f(0,0),Point2f(627,0),Point2f(0,627) ,Point2f(627,627) };
Mat rotation, img_dst;
rotation = getPerspectiveTransform(src, dst);
warpPerspective(img, img_dst, rotation, Size(img.cols, img.rows));
namedWindow("原图", WINDOW_NORMAL);
imshow("原图", img);
namedWindow("透视变换", WINDOW_NORMAL);
imshow("透视变换", img_dst);
waitKey(0);
return 0;
}

边栏推荐
- 消息的订阅和发布
- JS submit the form to determine whether the user name and password are empty
- 【论文阅读】GRAW+:A Two-View Graph Propagation Method With Word Coupling for Readability Assessment
- Pass parameters to the routing component
- Native JS get transform value x y z and rotate rotation angle
- Comparator (interface between comparable and comparator)
- MySQL-03 数据库操作
- 力扣------字符串中的单词数
- The last time I heard about eBay, or the last time
- 搞懂MySQL的数据类型中长度含义
猜你喜欢

Uncover the secret of white hat: 100 billion black products on the Internet scare musk away

ROS2学习(1)ROS2简述

Official announcement! Edweisen group and Baidu xirang reached a deep co creation cooperation

Use the requests library to crawl web pages

MySQL-03 数据库操作

天翼云Web应用防火墙(边缘云版)支持检测和拦截Apache Spark shell命令注入漏洞

Why does WPS refuse advertising?

万字长文,浅谈企业数字化建模蓝图

Concept and handling of exceptions

Basic syntax of MySQL DDL and DML and DQL
随机推荐
基于用户画像的在线健康社区用户流失预测研究
POM文件详解
力扣------字符串中的单词数
Understand the meaning of length in MySQL data types
[noip2003 popularity group] stack
C language_ Combination of structure and array
GDB common commands
Tdsql-c serverless: help start-ups achieve cost reduction and efficiency increase
MySQL-03 数据库操作
Sequence traversal of binary tree (implemented in C language)
[mathematical modeling] summary of common basic models
With frequent data leakage and deletion events, how should enterprises build a security defense line?
MySQL-04 存储引擎和数据类型
C语言_结构体指针变量引入
[paper reading] raw+:a two view graph propagation method with word coupling for readability assessment
Plato farm is expected to further expand its ecosystem through elephant swap
Pass parameters to the routing component
循环队列(c语言实现)
MySQL sets auto increment for existing primary keys
万字长文,浅谈企业数字化建模蓝图