Comments (6)
I'll look in to the issue once again. I'd like to replicate the error you're getting so could you comment the way you implemented the package and passed the image?
Thanks @MPJHorner
from identitydocuments.
New Laravel install, with basic config and using the simple controller implementation on your example. Passing both front/back image as JPEGs
from identitydocuments.
I'm able to pass any of the supported image types without issue. Both using images posted in a request and local image path work, and even remote images are supported, so you can give that a go too, for example a simple route to get the MRZ:
Route::post('/id', function(Request $request){
$id = new IdentityDocument('https://meneercasino.com/sites/default/files/styles/content_width_722_/public/files/kopie_paspoort.jpg');
$mrz = $id->getMrz();
return response()->json(['mrz' => $mrz]);
});
returns:
{
"mrz": "P<NLDDE<BRUIJN<<WILLEKE<LISELOTTE<<<<<<<<<<<SPECI20142NLD6503101F2401151999999990<<<<<82"
}
The error you're getting is not from this package but from Intervention, which means that the issue lies there or in your local environment (most likely). Make sure the GD extension is enabled, and check if there is no limit on the file upload size that might cause your images to not be complete.
from identitydocuments.
Closing this issue, do feel free to provide me with an update in the comments and I'd be happy to help you out further.
from identitydocuments.
Hey @HergenD used the exact example you gave above.
Except I am using tessaract.
This is my code...
Controller
$id = new IdentityDocument('https://meneercasino.com/sites/default/files/styles/content_width_722_/public/files/kopie_paspoort.jpg');
$id->setOcrService(Tesseract::class);
$mrz = $id->getMrz();
return response()->json(['mrz' => $mrz]);
Service
class Tesseract implements OCR
{
public function ocr(Image $image): OcrResponse
{
// TODO: Add OCR and return text
// return new OcrResponse('Response text');
// Store your image in a temp folder
$imagePath = sys_get_temp_dir().md5(microtime().random_bytes(5)).'.jpg';
$image->save($imagePath);
// Use Tesseract to create text response
$response = (new TesseractOCR($imagePath))->run();
// dd($response);
// Return the new response
$return = new OcrResponse($response);
return $return;
}
}
If i dd($response)
in the service I can see the text.
However the json restore should $mrz
is empty? Does it parse the correct values back from tessaract or do I need to pass it back differently in my service?
It currently returns this..
Werk365\IdentityDocuments\Responses\OcrResponse {#285 ▼
+text: """
assront KONINKRIJK DER NEDERLANDEN
PASSEPOR
RGDOM OF THE NETHERLANOS, ‘ROAM O65 PAYS-8AS
P NLD Nederlandse SPECI2014
De Bruijn
e/v Molenaar
saneenengen semtteone
Willeke Liselotte
icreterhe osm coeane
10 MAA/MAR 1965
1 qe orien one
Specimen =
vos ee —
vir 3 175m
eens oan annem in peen eon meryrae soe
15 JAN/JAN 2014 15 JAN/JAN 2024
A : em ——wewrnaen
4 Od > Burg. van Stad en Dorp
Ww. de Pugn
#00000 —— ®©00000
P<NLDDE<BRUI JN<<WILLEKE<LISELOTTE<<<<<<<<<<<¢
SPECI20142NLD6503101F2401151999999990<<<<<82
"""
}
from identitydocuments.
You seems to get an error due to there being a ¢
in the MRZ part of the tesseract result, I've had similar issues with tesseract being less accurate than google vision, a solution is to filter the result from any characters that you would not need to find on the document, like ¢
. You could do that in the tesseract service before returning the result
from identitydocuments.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from identitydocuments.