This commit is contained in:
xdrm-brackets 2017-09-13 17:24:07 +02:00
parent 84ee33f718
commit 7fa39e90d3
1 changed files with 40 additions and 25 deletions

View File

@ -228,7 +228,7 @@
/* (3) Exctracts an event
/* (3) Exctracts an event using OCR
*
* @uid<String> Image uid
* @start<Array> Start rect (x, y)
@ -236,8 +236,11 @@
*
---------------------------------------------------------*/
public function extractEvent($uid, $start=null, $stop=null){
$link = __ROOT__."/tmp/$uid.jpeg";
/* [1] Get the right clip
=========================================================*/
=========================================================*/ {
/* (1) Create clipped copy */
$clip = \imagecreatetruecolor($stop[0]-$start[0], $stop[1]-$start[1]);
@ -260,13 +263,25 @@
/* (3) Save to file */
\imagesavealpha($clip, true);
if( !\imagejpeg($clip, __ROOT__."/tmp/$uid.jpeg") )
if( !\imagejpeg($clip, $link) )
throw new \Exception("Cannot save image");
}
/* [2] Process OCR
=========================================================*/
// TODO:
=========================================================*/ {
/* (1) Creates a Tesseract (OCR) instance */
// $ocr = new Tesseract($link);
/* (2) Reads from file */
// $ocr->read();
}
}