当前位置:网站首页>First knowledge of opencv4.x --- image perspective transformation
First knowledge of opencv4.x --- image perspective transformation
2022-07-26 14:06:00 【F l e】
// Image perspective transformation
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
// Perspective transformation of image , need 3x3 The rotation matrix of , in total 9 Parameters , Through the original image and the transformed correspondence 4 A point can be constructed 12 Solve equations 9 Parameters
Mat img = imread("noobcvqr.png");
// Note that boundary points cannot be used , The image is 628*628, The maximum value is 627, Otherwise, an error will be reported
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(" Original picture ", WINDOW_NORMAL);
imshow(" Original picture ", img);
namedWindow(" Perspective transformation ", WINDOW_NORMAL);
imshow(" Perspective transformation ", img_dst);
waitKey(0);
return 0;
}

边栏推荐
- Construction practice of pipeline engine of engineering efficiency ci/cd
- MySQL-04 存储引擎和数据类型
- Go multithread communication, control coordination and main thread shutdown (sync.waitgroup)
- Convert the array in JSON file to struct
- Canvas upload image Base64 with cropping function jcrop.js
- Native JS get transform value x y z and rotate rotation angle
- 多态案例-制作饮品
- Research on Chinese medicine assisted diagnosis and treatment scheme integrating multiple natural language processing tasks -- taking diabetes as an example
- GDB common commands
- I. creation and constraint of MySQL table
猜你喜欢

"Intermediate and advanced test questions": what is the implementation principle of mvcc?

最新战报:十项认证,五项最佳实践

Integer internal cache

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

二叉树的层序遍历(C语言实现)

Circular queue (implemented in C language)

Videojs to canvas pause, play, switch video

Pytorch学习笔记(二)神经网络的使用

Large and small end mode

Re bet overseas: Alibaba, jd.com and SF again fight for "internal power"
随机推荐
@A thousand lines of work, ride the cloud together!
Add a display horizontal line between idea methods
Mobile dual finger scaling event (native), e.originalevent.touches
基于用户画像的在线健康社区用户流失预测研究
php使用sqlserver
Understand the meaning of length in MySQL data types
Multithreaded completable future usage
Joint entity and event extraction model based on multi task deep learning
[oauth2] VIII. Configuration logic of oauth2 login -oauth2loginconfigurer and oauth2clientconfigurer
How to quickly design a set of cross end components that support rendering rich text content
天翼云Web应用防火墙(边缘云版)支持检测和拦截Apache Spark shell命令注入漏洞
C语言_结构体和数组的结合
Solve the problem that JUnit of idea console cannot be input with scanner
JS download files, filesaver.js export txt and Excel files
MLX90640 红外热成像仪测温传感器模块开发笔记(六)
注解和反射
Leetcode215 the kth largest element (derivation of quick sort partition function)
Redis learning notes
Docker container MySQL enables binlog and scheduled backup
数据泄漏、删除事件频发,企业应如何构建安全防线?