当前位置:网站首页>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);
}
边栏推荐
- NPM command
- 树莓派连接天猫精灵音箱通过蓝牙播放音乐的方法
- 123123123
- Deep learning learning notes -- solve the problem of slow download of CONDA and pip
- I don't understand the MySQL 57 version under centos7 when I encounter a problem. I was informed by big Shen who knows it
- MySQL read / write lock
- [romance understood by technical talents] tidb community has prepared a gift for your partner for the "Tanabata Festival". Reply: if I want to challenge, I can participate in the activity!
- A guide for you to fully use TS
- [untitled] reprint
- 替换license是否要重启数据库?
猜你喜欢

Drools(3):Drools基础语法(1)

Realize the full link grayscale based on Apache APIs IX through MSE

LTS(Light-Task-Scheduler)

Precious metal knowledge: lethal short-term secret script

Yolov6 target detection practice: training your own data set (video tutorial)

What are the basics of getting started with spot silver

Do you know what "parts" MySQL contains?

Binary tree knowledge summary

Kernel pwn 入门 (5)

An album has been released, from introductory practical demonstration to advanced live Q & A, playing with container service so easy~
随机推荐
Summarize and learn STM32 to create project template
Flame diagram analysis Flink backpressure
20220725 compensator in automatic control principle
Difference between shape and size ()
AcWing-每日一题
123123123
字符串和内存函数
Agile and tidy way
Common programming shortcut keys of idea (take off after learning the operation)
浅谈eval与assert一句话木马执行区别
What are the basics of getting started with spot silver
[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
Common CMD instructions
[hardware ten treasures] - 7.1 [dynamic RAM] key points of DDR hardware design
Idea -- use @slf4j to print logs
Kubernetes scheduling concept and workflow
QT监听socket事件,使用QSocketNotifier类
Intention lock
Drools (3): drools basic syntax (1)
Log rotation logrotate