Closed mobileonekh closed 5 years ago
Hi @mobileonekh
You need to be a bit more specific with the speeds that you obtain.
The module has been tested on an old iPhone 5S and the scanning was pretty much instant. See for example the GIF image displayed in the Readme.
Thanks for your quick response. I am scanning ID Card(3 line mrz). i used 6+. The lighting condition is perfect. It took roughly 30 seconds
Here's a sample image of my country ID: https://imgur.com/a/JhaZHgJ
@mobileonekh ok, I tried to scan the posted ID and it worked fine for me (see the GIF below). Saying that, it's definitely more tricky to scan TD1 format due to performance optimisation. The scanner needs to detect that the document is in the TD1 format (by checking length of the lines), after that the parsed scope is increased to include 3 lines of text instead of default 2 - 2.5. Long story short, in order to parse it fast you need to make sure that the document is perfectly aligned within the rectangle.
This is definitely something I want have a look at and improve.
***Size of the rectangle was designed primarily for passports which are slightly bigger than ID cards. ID cards should therefore be placed rather in the bottom of the rectangle than trying to align them perfectly.
Ok, thanks. So you mean this is not due trained data. Improving trainedata will not improve this?
1 more thing, I run your orcb.traineddata manually against another source(https://github.com/Shreeshrii/tessdata_ocrb). I found their result is better and more accurate esp if the ID has some background or distraction.
Can you take a look?
So you mean this is not due trained data. Improving trainedata will not improve this?
That's correct. The recognition itself is fast. The problem is in the size of the cropped image (MRZ area) that is being processed.
1 more thing, I run your orcb.traineddata manually against another source(https://github.com/Shreeshrii/tessdata_ocrb). I found their result is better and more accurate esp if the ID has some background or distraction.
I've tried to implement it and I have also tried many other traineddate
files before, but the problem is in the compatibility. I'm getting the following error. I haven't really had time to investigate yet.
Failed to load any lstm-specific dictionaries for lang ocrb_int!!
Failed loading language 'ocrb_int'
Tesseract couldn't load any languages!
If i change the engine mode to: lstmOnly, it works
I managed to get it running. Apparently changes done to the source code have not been recompiled, so I had to clean the build folder.
The scanning seems to be more accurate, but it's super-slow in compare to the current one. It feels like it's doing 1 frame per 7 seconds. I will try to play with it a bit more. Did you have the same problem?
Edit: @mobileonekh I've just pushed a new version v1.1.5 which improves scanning of the TD1 documents. Have a look at it and let me know if you can see any difference.
Regarding the new traineddata
file, I ran some tests and the recognition was ~13x slower than the current one. It's simply unusable on older devices as the recognition can take up to 2-3 seconds per frame.
Thanks for your 1.1.5 update. It can scan Passport very fast. but for my country ID Card, it still take much time to recognize. I think maybe because it's 3 line mrz. Any idea on how to improve that?
Regarding the trained data i shared, please use the ocrb_int, it's much faster
v1.1.5 improves scanning of TD1 documents, so MRZ with 3 lines. If you still have the problem then try to send me a video. I’ve tried to scan the ID you referenced and also few others and it works pretty well. ID is recognised within 2 seconds.
Regarding the trained data that’s what I was running - ‘ocrb_int’.
@mobileonekh There has been a new version (v2) published which improves scanning of the TD1 documents among other types even more. Have a look at it.
wow! thanks for your very quick update. I think there's some lighting or reflecting issue. If i put the ID card behind a transparent plastic back, it can scan very fast. but if i scan directly, it took much time.
That's strange. I would expect having it inside the case would take longer.
I've just tried to scan my own ID card directly and it worked flawlessly multiple times in a row. It was recognised immediately without any issue. I have also tried 4 other different types on my screen and that worked well too. I honestly don't know what is going on on your side.
I don't think I can help you any more without seeing a video.
@mobileonekh Once again there has been a new version (v2.1.0) released which changes image preprocessing a bit. Try it out and let me know if you can see any change...
For me, v2.0 is better than v2.1. Can't detect anything with v2.1
I see. I will release 1 more update probably within a week which improves the scanning once again. Hopefully this time it will work correctly for you too. If not, then please create a new issue with more details (pics, video...), so I can determine the problem more accurately.
@mobileonekh ok, I tried to scan the posted ID and it worked fine for me (see the GIF below). Saying that, it's definitely more tricky to scan TD1 format due to performance optimisation. The scanner needs to detect that the document is in the TD1 format (by checking length of the lines), after that the parsed scope is increased to include 3 lines of text instead of default 2 - 2.5. Long story short, in order to parse it fast you need to make sure that the document is perfectly aligned within the rectangle.
This is definitely something I want have a look at and improve.
***Size of the rectangle was designed primarily for passports which are slightly bigger than ID cards. ID cards should therefore be placed rather in the bottom of the rectangle than trying to align them perfectly.
How can I achieve live text change like in this gif?
How can I achieve live text change like in this gif?
I used a modified version of the module here. I'm simply displaying the preprocessed image and the resulted text.
How can I achieve live text change like in this gif?
I used a modified version of the module here. I'm simply displaying the preprocessed image and the resulted text.
Is it possible to share some code?
I can't find it now. It was just quickly put together and as you can see I haven't had time to work on the project since (literally for a year now). But it's easy... in order to see the text just print the string into a label from here for example https://github.com/Mattijah/QKMRZScanner/blob/master/QKMRZScanner/QKMRZScannerView.swift#L90
I can't find it now. It was just quickly put together and as you can see I haven't had time to work on the project since (literally for a year now). But it's easy... in order to see the text just print the string into a label from here for example https://github.com/Mattijah/QKMRZScanner/blob/master/QKMRZScanner/QKMRZScannerView.swift#L90
I meant to print it like you did in the gif, the red text below the rectangle, that's what I wanted to achieve
I meant to print it like you did in the gif, the red text below the rectangle, that's what I wanted to achieve
That's what I explained above. Just set the text (let string = recognizedString
) to the label.
I meant to print it like you did in the gif, the red text below the rectangle, that's what I wanted to achieve
That's what I explained above. Just set the text (
let string = recognizedString
) to the label.
Thanks for the answer, I will try
I meant to print it like you did in the gif, the red text below the rectangle, that's what I wanted to achieve
That's what I explained above. Just set the text (
let string = recognizedString
) to the label.Thanks for the answer, I will try
I am able to achieve it, thanks again
Nice work and 99%+ accuracy but it's too slow. it takes so much time for it to recognize.
Any suggestion on how to improve its reading speed?