[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-ocrad] counting horizontal/vertical pixels
From: |
lode leroy |
Subject: |
[Bug-ocrad] counting horizontal/vertical pixels |
Date: |
Mon, 08 Aug 2005 12:21:30 +0200 |
I would like to propose the following new "feature": number of
vertical/horizontal pixels.
This will allow for easier testing for horizontal/vertical bars through the
characters.
(in casu, the 'fl' ligature)
--- orig/ocrad-0.12/profile.h 2005-05-19 11:22:14.000000000 +0200
+++ profile.h 2005-08-08 12:20:32.448742400 +0200
@@ -19,7 +19,7 @@
class Profile
{
public:
- enum Type { left, top, right, bottom, height, width };
+ enum Type { left, top, right, bottom, height, width, horizontal, vertical
};
private:
const Bitmap * _bitmap; // Bitmap to witch this profile belongs
--- orig/ocrad-0.12/profile.cc 2005-05-19 11:26:38.000000000 +0200
+++ profile.cc 2005-08-08 12:08:41.226054400 +0200
@@ -92,6 +103,28 @@ void Profile::initialize() throw()
while( l <= r && !b.get_bit( row, r ) ) --r;
data[i] = ( l <= r ) ? r - l + 1 : 0;
} break;
+ case horizontal :
+ data.resize( b.height() ); _limit = b.width();
+ for( int i = 0; i < samples(); ++i )
+ {
+ int row = b.top() + i;
+ int n = 0;
+ for(int col=b.left(); col<b.right(); col++) {
+ if (b.get_bit(row,col)) n++;
+ }
+ data[i] = n;
+ } break;
+ case vertical :
+ data.resize( b.width() ); _limit = b.height();
+ for( int i = 0; i < samples(); ++i )
+ {
+ int col = b.left() + i;
+ int n=0;
+ for(int row=b.top(); row<b.bottom(); row++) {
+ if (b.get_bit(row,col)) n++;
+ }
+ data[i] = n;
+ } break;
}
}