cloudmersive / cloudmersive_ocr_api_client
3.0.3
2023-07-01 22:04 UTC
Requires
- php: >=7.2.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-22 03:48:05 UTC
README
强大的光学字符识别(OCR)API可以将扫描的页面图像转换为可识别的文本。
Cloudmersive OCR API提供先进的机器学习能力,将扫描的文档和收据照片转换为文本。
- API版本:v1
- 包版本:3.0.3
要求
PHP 5.5 及以上
安装与使用
Composer
要使用Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/cloudmersive/cloudmersive_ocr_api_client.git"
}
],
"require": {
"cloudmersive/cloudmersive_ocr_api_client": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/cloudmersive_ocr_api_client/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门指南
请按照安装过程进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: Apikey $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Apikey', 'Bearer'); $apiInstance = new Swagger\Client\Api\ImageOcrApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $image_file = "/path/to/file.txt"; // \SplFileObject | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported. $language = "language_example"; // string | Optional, language of the input document, default is English (ENG). Possible values are ENG (English), ARA (Arabic), ZHO (Chinese - Simplified), ZHO-HANT (Chinese - Traditional), ASM (Assamese), AFR (Afrikaans), AMH (Amharic), AZE (Azerbaijani), AZE-CYRL (Azerbaijani - Cyrillic), BEL (Belarusian), BEN (Bengali), BOD (Tibetan), BOS (Bosnian), BUL (Bulgarian), CAT (Catalan; Valencian), CEB (Cebuano), CES (Czech), CHR (Cherokee), CYM (Welsh), DAN (Danish), DEU (German), DZO (Dzongkha), ELL (Greek), ENM (Archaic/Middle English), EPO (Esperanto), EST (Estonian), EUS (Basque), FAS (Persian), FIN (Finnish), FRA (French), FRK (Frankish), FRM (Middle-French), GLE (Irish), GLG (Galician), GRC (Ancient Greek), HAT (Hatian), HEB (Hebrew), HIN (Hindi), HRV (Croatian), HUN (Hungarian), IKU (Inuktitut), IND (Indonesian), ISL (Icelandic), ITA (Italian), ITA-OLD (Old - Italian), JAV (Javanese), JPN (Japanese), KAN (Kannada), KAT (Georgian), KAT-OLD (Old-Georgian), KAZ (Kazakh), KHM (Central Khmer), KIR (Kirghiz), KOR (Korean), KUR (Kurdish), LAO (Lao), LAT (Latin), LAV (Latvian), LIT (Lithuanian), MAL (Malayalam), MAR (Marathi), MKD (Macedonian), MLT (Maltese), MSA (Malay), MYA (Burmese), NEP (Nepali), NLD (Dutch), NOR (Norwegian), ORI (Oriya), PAN (Panjabi), POL (Polish), POR (Portuguese), PUS (Pushto), RON (Romanian), RUS (Russian), SAN (Sanskrit), SIN (Sinhala), SLK (Slovak), SLV (Slovenian), SPA (Spanish), SPA-OLD (Old Spanish), SQI (Albanian), SRP (Serbian), SRP-LAT (Latin Serbian), SWA (Swahili), SWE (Swedish), SYR (Syriac), TAM (Tamil), TEL (Telugu), TGK (Tajik), TGL (Tagalog), THA (Thai), TIR (Tigrinya), TUR (Turkish), UIG (Uighur), UKR (Ukrainian), URD (Urdu), UZB (Uzbek), UZB-CYR (Cyrillic Uzbek), VIE (Vietnamese), YID (Yiddish) $preprocessing = "preprocessing_example"; // string | Optional, preprocessing mode, default is 'Auto'. Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image before OCR is applied; this is recommended). try { $result = $apiInstance->imageOcrImageLinesWithLocation($image_file, $language, $preprocessing); print_r($result); } catch (Exception $e) { echo 'Exception when calling ImageOcrApi->imageOcrImageLinesWithLocation: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI相对于https://api.cloudmersive.com
模型文档
- BusinessCardRecognitionResult
- FieldResult
- FormDefinitionTemplate
- FormFieldDefinition
- FormRecognitionResult
- FormTableColumnDefinition
- FormTableDefinition
- GetPageAngleResult
- ImageToLinesWithLocationResult
- ImageToTextResponse
- ImageToWordsWithLocationResult
- OcrLineElement
- OcrPageResult
- OcrPageResultWithLinesWithLocation
- OcrPageResultWithWordsWithLocation
- OcrPhotoTextElement
- OcrWordElement
- PdfToLinesWithLocationResult
- PdfToTextResponse
- PdfToWordsWithLocationResult
- PhotoToWordsWithLocationResult
- Point
- ReceiptLineItem
- ReceiptRecognitionResult
- TableCellResult
- TableResult
- TableRowResult
授权文档
Apikey
- 类型:API密钥
- API密钥参数名称:Apikey
- 位置:HTTP头