当前位置:网站首页>Opencv learning warp Perspective
Opencv learning warp Perspective
2022-07-26 07:07:00 【Heihei_ study】
One 、 Get perspective transform matrix function GetPerspectiveTransform
CV_EXPORTS Mat getPerspectiveTransform(const Point2f src[], const Point2f dst[], int solveMethod = DECOMP_LU);Parameters src Source image quadrilateral vertex coordinates .
Parameters dst Quadrilateral vertex coordinates corresponding to the target image .
Parameters solveMethod Pass to cv::solve(#DecompTypes) The calculation method of , The default is DECOMP_LU
notes : At this point, we get a matrix ( Perspective transformation matrix )
Two 、 Perspective transformation function warpPerspective

Parameters :src The input image .
Parameters : dst Output image , have Size dsize And it has the same type as the source image .
Parameters : M 3*3 The transformation matrix of .
Parameters : dsize The size of the output image .

float w = 250, h = 350;
int main() {
string path = "C:\\Users\\Rong\\Desktop\\Resources\\cards.jpg";
Mat Img = imread(path);
// Two Point2f Array of !
// Pay attention to the src and dst In the same order !
Point2f src[4] = { {743,384},{1021,435},{965,783},{648,710} };
Point2f dst[4] = { {0,0},{w,0},{w,h},{0,h} };
Mat matrix,ImgWarp;
matrix = getPerspectiveTransform(src, dst);
warpPerspective(Img, ImgWarp, matrix, Size(w, h));
for (int i = 0; i < 4; i++) {
circle(Img, src[i], 10, Scalar(0, 0, 255), FILLED);
}
imshow("Image", Img);
imshow("Image Warp", ImgWarp);
waitKey(0);
}
边栏推荐
- 如何删除语句审计日志?
- Delete ^m from VIM
- Overview of new features of es11, ES12 and es13
- 【QT】详解 *.pro、*.pri、*.prf、*.prl文件
- Agile and tidy way
- one hundred and twenty-three million one hundred and twenty-three thousand one hundred and twenty-three
- 常用的cmd指令
- 针对前面文章的整改思路
- The results of the soft test can be checked, and the entry to query the results of the soft test has been opened in the first half of 2022
- Is the passenger flow always low? There is something wrong with the location of your store!
猜你喜欢

Basic operations and common functions of MySQL table creation

Summarize and learn STM32 to create project template

Flame diagram analysis Flink backpressure

哈夫曼编码原理

Question: can't download sh shellcheck Please install it manually and some commands of shell script

【无标题】转载

NPM command

What are the basics of getting started with spot silver

20220725 自动控制原理中的补偿器

Curl post request on the server, using postman tool for parameter conversion
随机推荐
Curve curvature display
Wechat applet - from entry to penetration
XSS labs (1-10) break through details
On stock price prediction model (3): are you falling into the trap of machine learning
Idea -- use @slf4j to print logs
Multi-objective collaborative decision-making in supply chain
Make a chase game with pyGame
「“xxxx“正在运行,可能导致系统卡顿,降低待机时间,点按关闭」处理
npm 命令
XSS-labs(1-10)闯关详解
在第一次使用德国小鸡要注意的地方
[Star Project] small hat aircraft War (III)
[arm learning (8) AXF tool analysis]
二叉树知识总结
Realize the full link grayscale based on Apache APIs IX through MSE
微信小程序 - 从入门到入土
每周小贴士#142:多参数构造函数和explicit
Introduce you to JVM from architecture
MySQL table write lock
LTS(Light-Task-Scheduler)