-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchangeDetection.php
More file actions
34 lines (27 loc) · 824 Bytes
/
changeDetection.php
File metadata and controls
34 lines (27 loc) · 824 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
<?php
require __DIR__ . '/vendor/autoload.php';
$keepProcessing = true;
$cv = new openCv\core();
$cv->init_legacy();
$cv->namedwindow();
$cv->namedwindow('Scene Change');
$capture = $cv->createCameraCapture();
if (!$cv->grabFrame($capture)) {
echo 'Error no camera detected!';
return -1;
}
else {
$img = $cv->queryFrame($capture);
$prev = $cv->cloneImage($img);
$diff = $cv->createImage($img->width, $img->height, $img->depth,1);
$diff->origin = $img->origin;
while($keepProcessing){
$img = $cv->queryFrame($capture);
$cv->copy($img, $prev);
$cv->changeDetection($prev, $img, $diff);
$cv->ffi->cvShowImage($cv->window_Title[0],$img);
$cv->ffi->cvShowImage($cv->window_Title[1],$diff);
$cv->waitKey(40);
}
}
$cv->destroyAllWindows();