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: Dmitry Katsubo
Subject: [Bug-ocrad] Re: OCRAD project: library is needed
Date: Thu, 15 Jul 2010 17:27:06 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100502 Shredder/3.0.5pre

Antonio Diaz Diaz wrote on 14.07.2010 16:18:
> 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.

Igor, can you send me the problematic image? Let's create test2 :)

>> 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 );

Antonio,

1) Why do you use check for "OCRAD_ok" for OCRAD_get_errno() return
value, but the rest you compare with "0"?

2) Maybe it makes sense to have a "combined" API function, that will
group OCRAD_recognize() + OCRAD_result_characters() +
OCRAD_result_first_character() ? This "if"-clause looks thrilling and it
horribly grows ...

-- 
With best regards,
Dmitry



reply via email to

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