bug-ocrad
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ocrad] Re: OCRAD project: library is needed


From: Antonio Diaz Diaz
Subject: [Bug-ocrad] Re: OCRAD project: library is needed
Date: Wed, 14 Jul 2010 16:18:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Igor Filippov [Contr] wrote:
I noticed a small glitch - for some characters which are touching the
boundaries of the bitmap_data the recognition fails. If I add an extra
line of whitespace on all four sides (left,right,top,bottom) those
characters get recognized, but the rest of them which were recognized
before are not. Is there supposed to be exactly one line of whitespace
on the side, or is it a bug?

The library interface (OCRAD_set_image*) should ignore any amount of surrounding whitespace. If what you describe is really happening, it is a bug.


Ok, I think I know where the problem is.
If there are two characters in the image block passed to OCRAD,
i.e. "AB" OCRAD recognizes both of them and
OCRAD_result_first_character() returns the first one - "A". I guess it
makes sense in some circumstances, but in my situation I need to have
either 1) Recognition fails and does not return anything if there is more than
one character,
2) Recognition sets a flag to indicate that more than one character was
recognized.

Perhaps 2) is already implemented? If not, I need it, otherwise the code
is not functioning as a replacement for "Blob" which I used for single
character recognition.

"2)" can currently be emulated, albeit not very conveniently:

  ( OCRAD_result_blocks( ocrdes ) == 1 &&
    OCRAD_result_lines( ocrdes, 0 ) == 1 &&
    OCRAD_result_line( ocrdes, 0, 0 ) != 0 &&
    strlen( OCRAD_result_line( ocrdes, 0, 0 ) == 1 )


I think implementing the function OCRAD_result_characters, which would return the number of characters in the image, could solve your problem. The resulting osra code could be like this:

  if( ocrdes && OCRAD_get_errno( ocrdes ) == OCRAD_ok &&
      OCRAD_set_image( ocrdes, opix, 0 ) == 0 &&
      ( height >= 10 || OCRAD_scale( ocrdes, 2 ) == 0 ) &&
      OCRAD_recognize( ocrdes, 0 ) == 0 &&
      OCRAD_result_characters( ocrdes ) == 1 )
    c2 = OCRAD_result_first_character( ocrdes );



Best regards,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]