Recent

Author Topic: Logo detection  (Read 9064 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Logo detection
« on: July 25, 2012, 05:00:32 pm »
Hi all,

I'm currently working on my own scanning/document management system for incoming letters etc.
https://bitbucket.org/reiniero/papertiger/overview
Currently on Linux; GUI client may be done on Linux and/or Windows (or web based)

I currently can scan using sane, generate a TIFF, do OCR with tesseract and combine the OCR text and the tiff image into a pdf with exactimage's hocr2pdf. I'm going to add support for a metadata database, and probably a full text index. Then I'd need a GUI viewer/searcher, desktop and/or web based.

Once things are working, I would like to (semi)automate some stuff such as detection of company logos on incoming letters.
Depending on my tesseract hocr output (or e.g. cuneiform if I also add support for that), I might be able to already limit the parts of the TIFF that contain graphics.

In any case, I'd like to be able to detect what company sent me a letter, presumably based on having an example scanned logo stored in the database and running some kind of tool/algorithm on it.

Any hints on the best way to do this?

Thanks!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

KpjComp

  • Hero Member
  • *****
  • Posts: 680
Re: Logo detection
« Reply #1 on: July 25, 2012, 05:28:20 pm »
Quote
Any hints on the best way to do this?

Image detection can be very complex.

But your could try -> http://opencv.org/

You maybe could also try using Neural Networks, but Neural Networks can require a fair bit of training, just having 1 sample of a Logo wouldn't be much use.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Logo detection
« Reply #2 on: July 26, 2012, 09:33:27 am »
Thanks KpjComp,

Looks like something like the SURF algorithm with OpenCV might be feasible. Will get back to this ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

avra

  • Hero Member
  • *****
  • Posts: 2586
    • Additional info
Re: Logo detection
« Reply #3 on: July 26, 2012, 10:27:48 am »
Looks like you are looking for invariant object recognition (google it) or something similar. I guess that could be achieved if you select a minimal rectangle with a logo on each fresh company, enter details, and store to the database for later comparison. Then with each new scan you look for recognition of objects (logos) from database, and if not found you have a new company (or a new logo for existing company).

http://www-i6.informatik.rwth-aachen.de/~keysers/da.pdf
http://stackoverflow.com/questions/10355993/algorithm-to-detect-an-image-in-another-image-with-some-noise
http://en.wikipedia.org/wiki/Outline_of_object_recognition
http://en.wikipedia.org/wiki/Haar-like_features
http://en.wikipedia.org/wiki/Scale-invariant_feature_transform
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Logo detection
« Reply #4 on: July 26, 2012, 11:07:01 am »
Thanks Avra... I hit on the SURF and other algorithms but feel like a pig looking at a wristwatch...

Still, I'll dive into it once I get done with the database stuff for my document scanning project ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

KpjComp

  • Hero Member
  • *****
  • Posts: 680
Re: Logo detection
« Reply #5 on: July 26, 2012, 11:21:11 am »
Quote
Looks like you are looking for invariant object recognition

Yes, you can do that with OpenCV.  That's basically what SURF that @Bigchimp mentioned will help with.

Quote
Looks like something like the SURF algorithm with OpenCV

Yes, that should do the trick.  Basically you would create a database of cropped Logo's and store the extracted features with them.  I would store the images as well as the feature, in case later you want to implement different feature extractor, or alter the number extracted features etc.

And as you scan you images in, you could compare each Feature, and the feature that gets more keypoints would be the winner.

I've used OpenCV with Delphi in the past, it's pretty easy to use.  It also has built in video camera API so you can do real time processing.

avra

  • Hero Member
  • *****
  • Posts: 2586
    • Additional info
Re: Logo detection
« Reply #6 on: July 27, 2012, 12:19:12 pm »
In the future I will probably have a need for using OpenCV with FPC on ARM Linux. If someone already has it working I am all ears...
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018