Leptonica  1.82.0
Image processing and image analysis suite
binreduce.c File Reference
#include <string.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

PIXpixReduceBinary2 (PIX *pixs, l_uint8 *intab)
 
PIXpixReduceRankBinaryCascade (PIX *pixs, l_int32 level1, l_int32 level2, l_int32 level3, l_int32 level4)
 
PIXpixReduceRankBinary2 (PIX *pixs, l_int32 level, l_uint8 *intab)
 
l_uint8 * makeSubsampleTab2x (void)
 

Detailed Description

     Subsampled 2x reduction
          PIX      *pixReduceBinary2()
     Rank filtered 2x reductions
          PIX      *pixReduceRankBinaryCascade()
          PIX      *pixReduceRankBinary2()
     Permutation table for 2x rank binary reduction
          l_uint8  *makeSubsampleTab2x(void)

Definition in file binreduce.c.

Function Documentation

◆ makeSubsampleTab2x()

l_uint8* makeSubsampleTab2x ( void  )

makeSubsampleTab2x()

Returns
tab table of 256 permutations, or NULL on error
Notes:
     Permutation table for 2x rank binary reduction
     This table permutes the bits in a byte, from
         0 4 1 5 2 6 3 7
     to
         0 1 2 3 4 5 6 7

Definition at line 391 of file binreduce.c.

Referenced by pixCompareWithTranslation().

◆ pixReduceBinary2()

PIX* pixReduceBinary2 ( PIX pixs,
l_uint8 *  intab 
)

pixReduceBinary2()

Parameters
[in]pixs
[in]intab[optional]; if null, a table is made here and destroyed before exit
Returns
pixd 2x subsampled, or NULL on error
Notes:
     (1) After folding, the data is in bytes 0 and 2 of the word,
         and the bits in each byte are in the following order
         (with 0 being the leftmost originating pair and 7 being
         the rightmost originating pair):
              0 4 1 5 2 6 3 7
         These need to be permuted to
              0 1 2 3 4 5 6 7
         which is done with an 8-bit table generated by makeSubsampleTab2x().

Definition at line 74 of file binreduce.c.

References L_Bilateral::pixs.

◆ pixReduceRankBinary2()

PIX* pixReduceRankBinary2 ( PIX pixs,
l_int32  level,
l_uint8 *  intab 
)

pixReduceRankBinary2()

Parameters
[in]pixs1 bpp
[in]levelrank threshold: 1, 2, 3, 4
[in]intab[optional]; if null, a table is made here and destroyed before exit
Returns
pixd 1 bpp, 2x rank threshold reduced, or NULL on error
Notes:
     (1) pixd is downscaled by 2x from pixs.
     (2) The rank threshold specifies the minimum number of ON
         pixels in each 2x2 region of pixs that are required to
         set the corresponding pixel ON in pixd.
     (3) Rank filtering is done to the UL corner of each 2x2 pixel block,
         using only logical operations.  Then these pixels are chosen
         in the 2x subsampling process, subsampled, as described
         above in pixReduceBinary2().

Definition at line 227 of file binreduce.c.

References L_Bilateral::pixs.

Referenced by pixCompareWithTranslation().

◆ pixReduceRankBinaryCascade()

PIX* pixReduceRankBinaryCascade ( PIX pixs,
l_int32  level1,
l_int32  level2,
l_int32  level3,
l_int32  level4 
)

pixReduceRankBinaryCascade()

Parameters
[in]pixs1 bpp
[in]level1threshold, in the set {0, 1, 2, 3, 4}
[in]level2threshold, in the set {0, 1, 2, 3, 4}
[in]level3threshold, in the set {0, 1, 2, 3, 4}
[in]level4threshold, in the set {0, 1, 2, 3, 4}
Returns
pixd, or NULL on error
Notes:
     (1) This performs up to four cascaded 2x rank reductions.
     (2) Use level = 0 to truncate the cascade.

Definition at line 152 of file binreduce.c.

References L_Bilateral::pixs.