Search code examples
ocrcbir

Image Comparisson using CBIR and OCR


Working on a project for Retrieving content from a given image and compare with other images in the repository and list out the matching images.

what should be right approach to do it so that the search wont slowdown eventually.

What I was planning to do as a first level of filtering was to use any Image Querying (CBIR technique) to retrieve images matching the pattern of given image. Then do OCR to get the image content and do a match check.

Please let me know if there is any better approach for this.


Solution

  • Steps done

    Softwares 1. Tesseract OCR 2. Image Magick - For image cleaning 3. Textcleaner script

    1. Found out the image orientation using Image Magick software

      • Convert package has a feature to find the image orientation using the EXIF data which is not that useful.
      • For this image was rotated 90 degree thrice and the ocr data for each was compared with the other to find the correct orientation. ( image with maximum number of words wins)
    2. OCRed the image to get the text and applied filtering to get the bill no, date and amount.

      • on success stores the details on DB for future search
      • on failure
        • Created 10 different images with different filters (gray scale mode and sharpment applied)
        • OCRed all images and found out the required data form all the data got.
    3. Saved data is used for future search feature to eradicate duplication