provide double scale
This commit is contained in:
@@ -75,6 +75,31 @@ class OCRController extends ApiController
|
||||
$data['ocr_greyscale'] = $result;
|
||||
imagedestroy($imgcreate);
|
||||
|
||||
// Double Scale
|
||||
$result = '';
|
||||
$srcImage = imagecreatefrompng($tmpfname);
|
||||
$srcWidth = imagesx($srcImage);
|
||||
$srcHeight = imagesy($srcImage);
|
||||
|
||||
$dstWidth = ($srcWidth * 2);
|
||||
$dstHeight = ($srcHeight * 2);
|
||||
$dstImage = imagecreatetruecolor($dstWidth, $dstHeight);
|
||||
|
||||
// Copy and resize the original image onto the new canvas
|
||||
imagecopyresampled($dstImage, $srcImage, 0, 0, 0, 0, $dstWidth, $dstHeight, $srcWidth, $srcHeight);
|
||||
|
||||
// Generate a temporary filename for the doubled-scale image
|
||||
$tmpfname_scaled = tempnam(sys_get_temp_dir(), 'double_scale');
|
||||
imagejpeg($dstImage, $tmpfname_scaled);
|
||||
imagedestroy($srcImage);
|
||||
imagedestroy($dstImage);
|
||||
|
||||
// OCR it
|
||||
$ocr->image($tmpfname_scaled);
|
||||
$result = $ocr->run(500);
|
||||
unlink($tmpfname_scaled);
|
||||
$data['ocr_double_scale'] = $result;
|
||||
|
||||
unlink($tmpfname);
|
||||
return $this->respondJson($data);
|
||||
}//end if
|
||||
@@ -82,7 +107,6 @@ class OCRController extends ApiController
|
||||
return $this->respondWithErrors(['url' => 'url is missing']);
|
||||
}
|
||||
|
||||
|
||||
// $ffmpeg = FFMpeg\FFMpeg::create();
|
||||
|
||||
// // Load the input video
|
||||
|
||||
Reference in New Issue
Block a user