src/skew.c
l_int32
pixFindSkewSweepAndSearch(PIX        *pixs,
                          l_float32  *pangle,
                          l_float32  *pconf,
                          l_int32     redsweep,
                          l_int32     redsearch,
                          l_float32   sweeprange,
                          l_float32   sweepdelta,
                          l_float32   minbsdelta)
{
    return pixFindSkewSweepAndSearchScore(pixs, pangle, pconf, NULL,
                                          redsweep, redsearch, 0.0, sweeprange, 
                                          sweepdelta, minbsdelta);
}
/*!
 *  pixFindSkewSweepAndSearch()
 *
 *      Input:  pixs  (1 bpp)
 *              &angle   (<return> angle required to deskew; in degrees)
 *              &conf    (<return> confidence given by ratio of max/min score)
 *              redsweep  (sweep reduction factor = 1, 2, 4 or 8)
 *              redsearch  (binary search reduction factor = 1, 2, 4 or 8;
 *                          and must not exceed redsweep)
 *              sweeprange   (half the full range, assumed about 0; in degrees)
 *              sweepdelta   (angle increment of sweep; in degrees)
 *              minbsdelta   (min binary search increment angle; in degrees)
 *      Return: 0 if OK, 1 on error or if angle measurment not valid
 *
 *  Notes:
 *      (1) This finds the skew angle, doing first a sweep through a set
 *          of equal angles, and then doing a binary search until
 *          convergence.
 *      (2) Caller must check the return value for validity of the result.
 *      (3) In computing the differential line sum variance score, we sum
 *          the result over scanlines, but we always skip:
 *           - at least one scanline
 *           - not more than 10% of the image height
 *           - not more than 5% of the image width
 *      (4) See also notes in pixFindSkewSweepAndSearchScore()
 */


(1) This finds the skew angle, doing first a sweep through a set
of equal angles, and then doing a binary search until
convergence.
(2) Caller must check the return value for validity of the result.
(3) In computing the differential line sum variance score, we sum
the result over scanlines, but we always skip:
- at least one scanline
- not more than 10% of the image height
- not more than 5% of the image width
(4) See also notes in pixFindSkewSweepAndSearchScore()
( 1 ) This finds the skew angle doing first a sweep through a set of equal angles and then doing a binary search until convergence . ( 2 ) Caller must check the return value for validity of the result . ( 3 ) In computing the differential line sum variance score we sum the result over scanlines but we always skip : - at least one scanline - not more than 10% of the image height - not more than 5% of the image width ( 4 ) See also notes in pixFindSkewSweepAndSearchScore ()
l_int32
pixFindSkewSweepAndSearch(PIX        *pixs,
                          l_float32  *pangle,
                          l_float32  *pconf,
                          l_int32     redsweep,
                          l_int32     redsearch,
                          l_float32   sweeprange,
                          l_float32   sweepdelta,
                          l_float32   minbsdelta)
{
    return pixFindSkewSweepAndSearchScore(pixs, pangle, pconf, NULL,
                                          redsweep, redsearch, 0.0, sweeprange, 
                                          sweepdelta, minbsdelta);
}
l_int32 pixFindSkewSweepAndSearch ( PIX * pixs , l_float32 * pangle , l_float32 * pconf , l_int32 redsweep , l_int32 redsearch , l_float32 sweeprange , l_float32 sweepdelta , l_float32 minbsdelta ) { return pixFindSkewSweepAndSearchScore ( pixs , pangle , pconf , NULL , redsweep , redsearch , 0.0 , sweeprange , sweepdelta , minbsdelta ) ; }
pixFindSkewSweepAndSearch()
      Input:  pixs  (1 bpp)
              &angle   (<return> angle required to deskew; in degrees)
              &conf    (<return> confidence given by ratio of max/min score)
              redsweep  (sweep reduction factor = 1, 2, 4 or 8)
              redsearch  (binary search reduction factor = 1, 2, 4 or 8;
                          and must not exceed redsweep)
              sweeprange   (half the full range, assumed about 0; in degrees)
              sweepdelta   (angle increment of sweep; in degrees)
              minbsdelta   (min binary search increment angle; in degrees)
      Return: 0 if OK, 1 on error or if angle measurment not valid
pixFindSkewSweepAndSearch () Input : pixs ( 1 bpp ) &angle ( <return > angle required to deskew ; in degrees ) &conf ( <return > confidence given by ratio of max / min score ) redsweep ( sweep reduction factor = 1 2 4 or 8 ) redsearch ( binary search reduction factor = 1 2 4 or 8 ; and must not exceed redsweep ) sweeprange ( half the full range assumed about 0 ; in degrees ) sweepdelta ( angle increment of sweep ; in degrees ) minbsdelta ( min binary search increment angle ; in degrees ) Return : 0 if OK 1 on error or if angle measurment not valid