Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRZ is too close to the remaining part of the card #63

Open
canklot opened this issue Apr 3, 2022 · 6 comments
Open

MRZ is too close to the remaining part of the card #63

canklot opened this issue Apr 3, 2022 · 6 comments

Comments

@canklot
Copy link

canklot commented Apr 3, 2022

I am having some problems about Some types of IDs (Romanian being one example), where the MRZ is too close to the remaining part of the card. Can you do something about it? Like applying some margin 5% to the largest box. Or some stronger erosion after merging the boxes together to break apart the borders from the MRZ. Or detecting the ID card or passport first and cropping it on the borders a little bit. I have been trying to do something about it for a few days but I am not experienced enough.

@konstantint
Copy link
Owner

I'd also be happy if someone who has access to such IDs, enough time, skill and motivation would try such experiments. Unfortunately, I personally don't have the resources necessary at this moment to explore this issue.

@canklot
Copy link
Author

canklot commented Apr 4, 2022

I'd also be happy if someone who has access to such IDs, enough time, skill and motivation would try such experiments. Unfortunately, I personally don't have the resources necessary at this moment to explore this issue.

https://disk.yandex.com.tr/i/8XuAENlZ8G_CoQ
https://disk.yandex.com.tr/i/GzUo9u3SjcH6_A

Here is one example. I checked the contours after the boone transform. And the borders connect together with MRZ field.
The Birthday check fails because she don't have birth day and month, just year. Just ignore it.

@konstantint

image-001
image
image
image

@canklot
Copy link
Author

canklot commented Apr 14, 2022

Hey man did you checked the files I provided? @konstantint

@konstantint
Copy link
Owner

konstantint commented Apr 16, 2022

You did read the second sentence in previous comment as well, right? ;)

@canklot
Copy link
Author

canklot commented Apr 16, 2022

You did read the second sentence in previous comment as well, right? ;)

My bad sorry. I thought you just don't have images. Well I am onto it. Might send you a pull request in a week or so.

@canklot
Copy link
Author

canklot commented Apr 18, 2022

I find a work around/fix. First I tried cropping the borders but tesseract performs bad when there is no white borders. So I draw white lines on top of the borders. Here is the code for others

def white_borders(img,thickness):
    img_height=img.shape[0]
    img_width=img.shape[1]
    percent_to_pix = int(img_width * thickness / 100)
    cv2.line(img,(0,0),(0,img_height),(255,255,255),percent_to_pix)
    cv2.line(img,(img_width,0),(img_width,img_height),(255,255,255),percent_to_pix)
    #plt.imshow(img, interpolation='nearest')
    #plt.title('white border')
    #plt.show()
    return img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants