Created
October 3, 2017 01:19
-
-
Save symisc/4832c8c8c65329c55b01fea81c962d5b to your computer and use it in GitHub Desktop.
Given an input image with human readable characters. Detect input language & extract text content from there using PixLab OCR (https://pixlab.io/cmd?id=ocr)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github | |
* https://github.com/symisc/pixlab-php | |
*/ | |
require_once "pixlab.php"; | |
# Given an image with human readable characters. Detect input language & extract text content from there. | |
# https://pixlab.io/#/cmd?id=ocr for additional information. | |
/* Target image with human readable text input */ | |
$img = 'http://quotesten.com/wp-content/uploads/2016/06/Confucius-Quote.jpg'; | |
# Your PixLab key | |
$key = 'My_PixLab_Key'; | |
/* Process */ | |
$pix = new Pixlab($key); | |
if( !$pix->get('ocr',array('img' => $img)) ){ | |
echo $pix->get_error_message()."\n"; | |
die; | |
} | |
echo "Input language: ".$pix->json->lang; | |
echo "\nText Output: ".$pix->json->output."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment