bug-ocrad
[Top][All Lists]
Advanced

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

[Bug-ocrad] improving detection of "rv" instead of "N"


From: lode leroy
Subject: [Bug-ocrad] improving detection of "rv" instead of "N"
Date: Fri, 29 Jul 2005 15:43:45 +0200

This improves the discrimination between "N" and merged "rv".

-- lode

~/pkg/ocrad-0.12 $ diff -Nurpw orig/ocrad-0.12/character_r11.cc .
--- orig/ocrad-0.12/character_r11.cc    2005-05-23 13:13:46.000000000 +0200
+++ ./character_r11.cc  2005-07-29 15:40:19.694569600 +0200
@@ -93,6 +93,31 @@ void Character::recognize110( const Char
        add_guess( 'r', b.right() ); return; }
      }
    }
+#if 1
+  if ( code == 'N' )  // Looks for merged 'rv'
+    { // detect position of minimal number of pixels vertically
+       int mincol = 0;
+       int mincount = b.height();
+       for(int col=b.hpos(10); col<b.hpos(90); col++) {
+           int count = 0;
+           for(int row=b.top(); row<b.bottom(); row++) {
+               count+=b.get_bit(row,col);
+           }
+           if (count < mincount) {
+               mincount = count;
+               mincol = col;
+           }
+       }
+       if ((mincol > b.hpos(40)) && (mincol < b.hpos(50))) {
+           if (b.top() >= charbox.top() ) {
+               only_guess(0, b.left() );
+               add_guess ( 'r', mincol );
+               add_guess( 'v', b.right() );
+               return;
+           }
+       }
+    }
+#endif
  if( code ) { add_guess( code, 0 ); return; }
  if( f.bp.minima( b.height() / 8 ) == 2 )
    {






reply via email to

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