MAN page from Mandrake Other XITE-3.3-3.i386.rpm
BIN_WR2
Section: C Library Functions (3)
Updated: 16 Mar 1998
Index
NAME
bin_wr2, bin_iwr - binarize a gray-scale band usingWhite and Rohrer`s method
SYNTAX
#include <
xite/binarize.h>
int bin_wr2( int mode, int activity_limit,
double distance_limit, int mean_size,
int search_vec_len, int diagonal,
int max_limit, int spot_size_limit,
IBAND inband, IBAND outband,
int intermediate_images );
int bin_iwr( int mode, int activity_limit,
int mean_size, int max_limit,
int spot_size_limit, IBAND inband,
IBAND outband, int intermediate_images );
DESCRIPTION
The input band
inbandis binarized using the
Integrated function Algorithmof White and Rohrer, or animproved version. The result is returned in
outband.Several improvements and variations of the method have beenimplemented; some of these are available in bin_wr2,but toget all the improvements, bin_iwrmust be used followed byremove_ghost.
White and Rohrer`s method uses a gradient-like operator calledthe activity on the image. Pixels with activity belowactivity_limitare labeled 0.The other pixels are furthertested. If the Laplacian edge operator of the pixel ispositive, the pixel is labeled +,otherwise -.That way athree-level label-image is constructed, with legal pixelvalues +,0and -.The idea is that in a sequence oflabels, edges are identified as -+transitions or +-transitions. Object pixels are assumed to be +and 0labeled pixels between a -+and +-pair. For each pixel tobe classified, a search vector of length search_vec_lenforeach search direction is centered on the pixel. The -+and+-must be inside the seach vector to be recognized. Byusing a low value on search_vec_len,only lines and smallfilled areas will be captured.
If spot_size_limit> 1, then small +-labeled regionshaving less than spot_size_limitpixels are relabeled as0-regions.
By specifying activity_limit= 0, Kitler and Illingworth`smethod is used to set the activity threshold. An upper boundfor this value is specified by max_activity.
A lower limit on the distance between the -+and +-forpixels to be classified as object pixels is specified bydistance_limit.This can be used to eliminate the thinnestlines in inband.
The first improvement suggested by Trier and Taxt [1] can beused in bin_wr2:
The input image is smoothed by a mean filter of size(mean_sizex mean_size)to remove stochastic noise. To runthe original White and Rohrer`s method, mean_size= 1 mustbe used.
Variations on how pixels are classified as printorbackgroundare selected though the modeparameter:
If mode= WR_TWO_BY_TWO, the original approach is used. Twotimes two pixels are classified at a time, requiring that allfour pixels are inside either horizontal or vertical objectpixel sequences.
The reasons for classifying (2 x 2) pixels at a time in theoriginal implementation was partly to save computational time,partly to reduce noise. With faster computers, a moretime-consuming algorithm may be allowed.
If mode= WR_DOUBLE_VECTORS, then the idea is that a singlepixel being part of an object pixel sequence is not enough. Ithas to have support from at least one of its neighbors. Eitherone of its vertical neighbors and the pixel itself have to beinside horizontal object pixel sequences or one of itshorizontal neighbors and the pixel itself must be insidevertical object pixel sequences to be recognized as objectpixels.
If mode= WR_SINGLE_VECTOR, only a single search vector isused in each direction.
If diagonal>= 1, then the horizontal and vertical searchdirections are complemented with two diagonal searchdirections. If diagonal== 0, then only the horizontal andvertical search directions are used.
If intermediate_images> 0, then some intermediate imagesare saved during the execution. This is useful for analyzingthe method.
- .I bin_iwr
bin_iwris an improved version of bin_wr2.Theparameter list is somewhat different. The modeparameter is kept for future improvements, but iscurrently ignored. The distance limit,search_vec_len,and diagonalparameters have beendiscarded from the parameter list, sincethe use of search vectors to locate print pixels inthe three-level label image is abandoned in bin_iwr.
Instead, the following approach is used. First, all"+"-marked regions are labeled printand "-"-markedregions are marked backgrond.Then, for each"0"-marked region, the number of "-" and "+"pixels that are 8-connected to the region is counted.If the number of "+" pixels is in majority, the"0" -marked region is labeled print,otherwisebackground.
This approach prodces a lot of noise which can be seenas spurious print components, which must be removedby using remove_ghostafterwards.
RESTRICTIONS
inbandand
outbandmust have pixel type unsigned byte.
SEE ALSO
binarize(1)
REFERENCES
- [1]
- Řivind Due Trier & Torfinn Taxt"Improvement of `integrated function algorithm` forbinarization of document images",Pattern Recognition Letters, to appear.
- [2]
- J.M. White & G.D. Rohrer"Image Thresholding for Optical Character Recognition andOther Applications Requiring Character Image Extraction",IBM Journal of Research and Development, vol 27, no 4,pp 400-411, July 1983.
RETURN VALUE
0 : ok
1 : Bad input pixel type
2 : Bad output pixel type
FILES
src/binarize/bin_wr2.c
AUTHOR
Řivind Due Trier
ID
$Id: bin_wr2.c,v 1.11 1997/01/14 15:46:58 svein Exp $
Index
- NAME
- SYNTAX
- DESCRIPTION
- RESTRICTIONS
- SEE ALSO
- REFERENCES
- RETURN VALUE
- FILES
- AUTHOR
- ID
This document was created byman2html,using the manual pages.