-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.php
More file actions
executable file
·37 lines (28 loc) · 975 Bytes
/
processor.php
File metadata and controls
executable file
·37 lines (28 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once './vendor/autoload.php';
const WEB_PATH = './web/';
$imgPath = WEB_PATH . '3.jpg';
$dualImgPath = WEB_PATH . '3_dual.jpg';
$imgResizedPath = WEB_PATH . '3_resized.jpg';
$dualImgResizedPath = WEB_PATH . '3_dual_resized.jpg';
$baseImgWithSeamsFile = WEB_PATH . '3_seams.jpg';
$picture = new Picture($imgPath);
$seamCarver = new SeamCarver($picture);
$seamCarver->outputDualGradientPicture($dualImgPath);
$x = '150';
$y = '0';
# collect and remove seams
$vSeams = [];
$hSeams = [];
for ($i = 0; $i < $x; $i++) {
$vSeams[] = $seamCarver->findVerticalSeam();
$seamCarver->removeVerticalSeam($vSeams[$i]);
}
for ($i = 0; $i < $y; $i++) {
$hSeams[] = $seamCarver->findHorizontalSeam();
$seamCarver->removeHorizontalSeam($hSeams[$i]);
}
// output images with removed seams
$picture->output($imgResizedPath);
$seamCarver->outputDualGradientPicture($dualImgResizedPath);
$picture->outputWithSeams($hSeams, $vSeams, $baseImgWithSeamsFile);