Skip to content

Commit 2d131f4

Browse files
committed
warpPerspective
1 parent 08b0f56 commit 2d131f4

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ faceRecognition/att_faces/
44
faceRecognition/myFaces/*
55
faceRecognition/myPics/*
66

7-
!.gitkeep
7+
!.gitkeep
8+
composer.lock
9+
vendor
10+
core

ImgProc/warpPerspective/1.png

217 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use function CV\{
4+
getPerspectiveTransform, imread, warpPerspective
5+
};
6+
use CV\{
7+
Point, Size
8+
};
9+
10+
$srcPoints = [
11+
new Point(165, 270),
12+
new Point(835, 270),
13+
new Point(360, 125),
14+
new Point(615, 125),
15+
];
16+
$dstPoints = [
17+
new Point(165, 270),
18+
new Point(835, 270),
19+
new Point(165, 200),
20+
new Point(835, 200),
21+
];
22+
$mat = getPerspectiveTransform($srcPoints, $dstPoints, CV\DECOMP_LU);
23+
24+
var_dump($mat);
25+
$mat->print();
26+
27+
$image = imread("1.png");
28+
$perspective = new \CV\Mat(1, 1, \CV\CV_8UC3);
29+
$perspective = null;
30+
warpPerspective($image, $perspective, $mat, new Size(960, 270), 1);
31+
\CV\imshow('test', $perspective);
32+
\CV\waitKey(0);

composer.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"require": {
3+
"php": ">=7.0.0"
4+
},
5+
"require-dev": {
6+
"hihozhou/php-opencv-ide-helper": "dev-master"
7+
}
8+
}

0 commit comments

Comments
 (0)