4

I have a database with two kinds of images:

  • Photos with text integrated or not
  • Images that only contains a background color and text over it

I have a delphi webservice and I want to send to the clients only the photos. Does exist any simple and fast algorithm to detect if a image is only a background with text over it? What type of approach should use?

Thanks in advance

  • possible duplicate of [Recognizing text from a picture in delphi](http://stackoverflow.com/questions/4919094/recognizing-text-from-a-picture-in-delphi) – kobik Jul 10 '12 at 08:24
  • I don't want to extract the text. I want to differenciate a image with text inside of plain background with text over it –  Jul 10 '12 at 08:34

2 Answers2

5

You can use an OCR (Optical Character Recognition) library. Take a look at this question.

Community
  • 1
  • 1
RBA
  • 12,337
  • 16
  • 79
  • 126
  • 1
    Really I want to know if a image is only text with background or text over a picture. What relationship has this with ocr? –  Jul 10 '12 at 10:20
  • 1
    OCR will (possibly) pick out the text from the image if it has an picture background. If the OCR comes back with any text that makes sense then its text, if not its an picture. If it's plain text on a plain background then colour counting would be quicker/easier. – sergeantKK Jul 11 '12 at 11:27
5

You could probably do it faster if you count image colors. See the CountColors function in the ImageProcessingPrimitives.PAS unit.

Since the background is one color.

Community
  • 1
  • 1
Panos Kalatzantonakis
  • 12,525
  • 8
  • 64
  • 85
  • and if the format change in the future? and background is replaced with an image? – RBA Jul 10 '12 at 13:02
  • 2
    nice solution :) continuing this, you may scan just first line of image, or at least 2-3 lines distributed vertically and check for pixel color. If you have max 2 colors - bingo, it's a number. Will be much faster than scanning entire image. – Marcodor Jul 10 '12 at 13:26