How do I detect if two text images are similar without OCR? - python

I'm trying to compare two images with usernames and check if both are the same. I'm not able to use OCR Tesseract because the usernames can have letters from two or three different languages. Because of this, Tesseract is not able to parse the text from the image. I used ImageHash to try and figure out if the images are similar.
But when I try to compare this image:
then ImageHash gives me a result that user name Mustang1202 is more similar to this image than Mustang1203.
Is there a different way I can detect similar text in images?

Related

Detect (and maybe decode) PDF417 barcodes using python

I am trying to detect the pdf417 barcode (2D barcode) from an image using python.
I will be receiving images of IDs where there is a barcode in them but it might not always be straight. So I am looking for an effective way to DETECT the pdf417 barcode using Python.
I tried all of the available methods that I could find (that uses python)
e.g.,
pdf417decoder: requires the image to be cut exactly around the barcode just like in the image below:
pyzbar: only detects 1D barcodes
python-zxing and zxing: didn't detect any of the pdf417 barcodes that I tried (around 10 different IDs - different country)
Barcode-detection: this is a DL approach that uses YOLO-V3 to detect barcodes, but again (after trying it), it only detects 1D barcodes...
Is there a method that I missed?
Am I using a wrong approach towards this problem?
Possible solution that I am thinking of: using computer vision (some filters and transformations) to detect a box that has black and white dots... Something similar to this.
Thanks!
After various trials, I ended up using an approach of template matching by OpenCV.
You need to precisely choose your template image that will be the search reference of your algorithm. You need to feed it some grayscaled images.
Then, you need to choose the boxes that have a result higher than a certain threshold (for me 0.55). Then apply NMS (non max suppression) to filter out the noisy boxes.
But keep in mind that there are many edge cases to encounter. If someone is interested to see the complete solution, please let me know.

What could be the solution for automatically Document Image Unwarping caused by 3d warping?

I want to make some kind of python script that can do that.
In my case i just want very simple unwarping as follow
Always having similar backgroud
Always Placing page at similar position
Always having same type of wraped image
I tried following methods but didn't work out.
I tried so many scanning apps but no app can unwarp 3d wrap
for example this one microsoft office lens
.
I tried page_dewarp.py. But it does not work with pages having spaces between texts or having segments of texts and most of times for that kind of images it just revert cure from left to right or vice versa and also unable to detect actual text area for example
I found deep-learning-for-document-dewarping that is trying to solve this problem by using pix2pixHD But i am not sure this is gona work and this project don't have trained models and currectly not solving the problem. should i train a model with just following training data train_A - warped input images and train_B - unwarped output images as mentioned at pix2pixHD. I can generate training data by make warped and uwarped images using blender 3d. In this way i can generate so many images by using some scanned book's pages by just rendering uwarped image and warped image it like someone taking photos of pages but virtually.

Is there any way to recognise or extract underlined words using python from image?

I have a bunch of words extracted from a particular image using Tesseract OCR library. After doing so, is there any way to detect words which are being underlined or they have a box around them?

How to extract only ID photo from CV with pdfimages

Hi I tried to use pdfimages to extract ID images from my pdf resume files. However for some files they return also the icon, table lines, border images which are totally irrelevant.
Is there anyway I can limit it to only extract person photo? I am thinking if we can define a certain size constraints on the output?
You need a way of differentiating images found in the PDF in order to extract the ones of interest.
I believe you have the options of considering:
Image characteristics such as Width, Height, Bits Per Component, ColorSpace
Metadata information about the image (e.g. a XMP tag of interest)
Facial recognition of the person in the photo or Form recognition of the structure of the ID itself.
Extracting all of the images and then use some image processing code to analyze the images to identify the ones of interest.
I think 2) may be the most reliable method if the author of the PDF included such information with the photo IDs. 3) may be difficult to implement and get a reliable result from consistently. 1) will only work if that is a reliable means of identifying such photo IDs for your PDF documents.
Then you could key off of that information using your extraction tool (if it lets you do that). Otherwise you would need to write your own extraction tool using a PDF library.

Comparison of one image with a base of images

I want to compare an image of a front of a car with a database of images with other cars and tell me that most likely match of it.
Program firstly shall find key points and descriptors of the database of the images using SURF and try to compare them with Flann matcher.
But I simply can't understand how it should work. I'll have matches of the various pairs of images, but how can I compare the images and show relative output?

Categories

Resources