app/src/main/jni/GroupRunLength.cpp
int LocalFilter( LINE Line, COLRUNLENGTH *ColRun, int nRun )
{
	int		i;
	int		DIST_TH = 3;

	//y = b*x + a
	double	a, b;
	GetLineParam( ColRun, nRun, a, b );
	for( i=0; i<nRun; i++ )
	{
		if( ColRun[i].bUsed == FALSE )	continue;

		int y = (int)(a + b*ColRun[i].x );
		int	dys = ColRun[i].ys - y;
		int dye = ColRun[i].ye - y;
		if( dys * dye < 0 )		continue;
		else if( min( abs(dys), abs(dye) ) > DIST_TH )
			ColRun[i].bUsed = FALSE;
	}
	return 0;
}
/******************************************************************************
/*	Name:		LocalFilter
/*	Function:	Using local filter to exclude some candidate column run length from 
/*				composing a line.
/*	Parameter:	Line	-- A line
/*				ColRun	-- Column runlength
/*				nRun	-- Number of runlength
/*	Return:		0  -- Succeed
/*				-1 -- Error
/*****************************************************************************/
LocalFilter
Function:       Using local filter to exclude some candidate column run length from
composing a line.
LocalFilter Function : Using local filter to exclude some candidate column run length from composing a line .
int LocalFilter( LINE Line, COLRUNLENGTH *ColRun, int nRun )
{
	int		i;
	int		DIST_TH = 3;
	double	a, b;
	GetLineParam( ColRun, nRun, a, b );
	for( i=0; i<nRun; i++ )
	{
		if( ColRun[i].bUsed == FALSE )	continue;
		int y = (int)(a + b*ColRun[i].x );
		int	dys = ColRun[i].ys - y;
		int dye = ColRun[i].ye - y;
		if( dys * dye < 0 )		continue;
		else if( min( abs(dys), abs(dye) ) > DIST_TH )
			ColRun[i].bUsed = FALSE;
	}
	return 0;
}
int LocalFilter ( LINE Line , COLRUNLENGTH * ColRun , int nRun ) { int i ; int DIST_TH = 3 ; double a , b ; GetLineParam ( ColRun , nRun , a , b ) ; for ( i = 0 ; i < nRun ; i ++ ) { if ( ColRun [ i ] . bUsed == FALSE ) continue ; int y = ( int ) ( a + b * ColRun [ i ] . x ) ; int dys = ColRun [ i ] . ys - y ; int dye = ColRun [ i ] . ye - y ; if ( dys * dye < 0 ) continue ; else if ( min ( abs ( dys ) , abs ( dye ) ) > DIST_TH ) ColRun [ i ] . bUsed = FALSE ; } return 0 ; }
Name:           LocalFilter
Function:       Using local filter to exclude some candidate column run length from
composing a line.
Name : LocalFilter Function : Using local filter to exclude some candidate column run length from composing a line .
//y = b*x + a