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

Go to the source code of this file.

Macros

#define L_BUF_SIZE   512
 

Functions

SELAselaAddBasic (SELA *sela)
 
SELAselaAddHitMiss (SELA *sela)
 
SELAselaAddDwaLinear (SELA *sela)
 
SELAselaAddDwaCombs (SELA *sela)
 
SELAselaAddCrossJunctions (SELA *sela, l_float32 hlsize, l_float32 mdist, l_int32 norient, l_int32 debugflag)
 
SELAselaAddTJunctions (SELA *sela, l_float32 hlsize, l_float32 mdist, l_int32 norient, l_int32 debugflag)
 
SELAsela4ccThin (SELA *sela)
 
SELAsela8ccThin (SELA *sela)
 
SELAsela4and8ccThin (SELA *sela)
 
SELselMakePlusSign (l_int32 size, l_int32 linewidth)
 

Variables

static const l_int32 num_linear = 25
 
static const l_int32 basic_linear []
 
static const char * sel_4_1
 
static const char * sel_4_2
 
static const char * sel_4_3
 
static const char * sel_4_4
 
static const char * sel_4_5
 
static const char * sel_4_6
 
static const char * sel_4_7
 
static const char * sel_4_8
 
static const char * sel_4_9
 
static const char * sel_8_1
 
static const char * sel_8_2
 
static const char * sel_8_3
 
static const char * sel_8_4
 
static const char * sel_8_5
 
static const char * sel_8_6
 
static const char * sel_8_7
 
static const char * sel_8_8
 
static const char * sel_8_9
 
static const char * sel_48_1
 
static const char * sel_48_2
 

Detailed Description

     Contains definitions of simple structuring elements
     Basic brick structuring elements
         SELA    *selaAddBasic()
              Linear horizontal and vertical
              Square
              Diagonals
     Simple hit-miss structuring elements
         SELA    *selaAddHitMiss()
              Isolated foreground pixel
              Horizontal and vertical edges
              Slanted edge
              Corners
     Structuring elements for comparing with DWA operations
         SELA    *selaAddDwaLinear()
         SELA    *selaAddDwaCombs()
     Structuring elements for the intersection of lines
         SELA    *selaAddCrossJunctions()
         SELA    *selaAddTJunctions()
     Structuring elements for connectivity-preserving thinning operations
         SELA    *sela4ccThin()
         SELA    *sela8ccThin()
         SELA    *sela4and8ccThin()
     Other structuring elements
         SEL    *selMakePlusSign()

Definition in file sel2.c.

Function Documentation

◆ sela4and8ccThin()

SELA* sela4and8ccThin ( SELA sela)

sela4and8ccThin()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds the 2 basic sels for either 4-cc or 8-cc thinning.

Definition at line 846 of file sel2.c.

References selaCreate(), and selCreateFromString().

Referenced by selaMakeThinSets().

◆ sela4ccThin()

SELA* sela4ccThin ( SELA sela)

sela4ccThin()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds the 9 basic sels for 4-cc thinning.

Definition at line 764 of file sel2.c.

References selaCreate(), and selCreateFromString().

Referenced by selaMakeThinSets().

◆ sela8ccThin()

SELA* sela8ccThin ( SELA sela)

sela8ccThin()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds the 9 basic sels for 8-cc thinning.

Definition at line 805 of file sel2.c.

References selaCreate(), and selCreateFromString().

Referenced by selaMakeThinSets().

◆ selaAddBasic()

SELA* selaAddBasic ( SELA sela)

selaAddBasic()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds the following sels:
           ~ all linear (horiz, vert) brick sels that are
             necessary for decomposable sels up to size 63
           ~ square brick sels up to size 10
           ~ 4 diagonal sels

Definition at line 99 of file sel2.c.

References L_BUF_SIZE, and selaCreate().

◆ selaAddCrossJunctions()

SELA* selaAddCrossJunctions ( SELA sela,
l_float32  hlsize,
l_float32  mdist,
l_int32  norient,
l_int32  debugflag 
)

selaAddCrossJunctions()

Parameters
[in]sela[optional]
[in]hlsizelength of each line of hits from origin
[in]mdistdistance of misses from the origin
[in]norientnumber of orientations; max of 8
[in]debugflag1 for debug output
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds hitmiss Sels for the intersection of two lines.
         If the lines are very thin, they must be nearly orthogonal
         to register.
     (2) The number of Sels generated is equal to norient.
     (3) If norient == 2, this generates 2 Sels of crosses, each with
         two perpendicular lines of hits.  One Sel has horizontal and
         vertical hits; the other has hits along lines at +-45 degrees.
         Likewise, if norient == 3, this generates 3 Sels of crosses
         oriented at 30 degrees with each other.
     (4) It is suggested that hlsize be chosen at least 1 greater
         than mdist.  Try values of (hlsize, mdist) such as
         (6,5), (7,6), (8,7), (9,7), etc.

Definition at line 438 of file sel2.c.

References generatePtaLineFromPt(), L_BUF_SIZE, L_INSERT, L_SET_PIXELS, lept_mkdir(), pixaAddPix(), pixaCreate(), pixaDisplayTiledAndScaled(), pixaGetPixDimensions(), pixCreate(), pixDestroy(), pixPaintThroughMask(), pixRenderPta(), pixScaleBySampling(), pixSetAll(), pixSetPixel(), ptaDestroy(), ptaJoin(), selaAddSel(), selaCreate(), and selCreateFromColorPix().

◆ selaAddDwaCombs()

SELA* selaAddDwaCombs ( SELA sela)

selaAddDwaCombs()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds all comb (horizontal, vertical) Sels that are
         used in composite linear morphological operations
         up to 63 pixels in length, which are the sizes over
         which dwa code can be generated.

Definition at line 368 of file sel2.c.

References L_BUF_SIZE, selaCreate(), and selectComposableSizes().

◆ selaAddDwaLinear()

SELA* selaAddDwaLinear ( SELA sela)

selaAddDwaLinear()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds all linear (horizontal, vertical) sels from
         2 to 63 pixels in length, which are the sizes over
         which dwa code can be generated.

Definition at line 326 of file sel2.c.

References L_BUF_SIZE, selaAddSel(), selaCreate(), and selCreateBrick().

◆ selaAddHitMiss()

SELA* selaAddHitMiss ( SELA sela)

selaAddHitMiss()

Parameters
[in]sela[optional]
Returns
sela with additional sels, or NULL on error

Definition at line 188 of file sel2.c.

References selaAddSel(), selaCreate(), and selCreateBrick().

◆ selaAddTJunctions()

SELA* selaAddTJunctions ( SELA sela,
l_float32  hlsize,
l_float32  mdist,
l_int32  norient,
l_int32  debugflag 
)

selaAddTJunctions()

Parameters
[in]sela[optional]
[in]hlsizelength of each line of hits from origin
[in]mdistdistance of misses from the origin
[in]norientnumber of orientations; max of 8
[in]debugflag1 for debug output
Returns
sela with additional sels, or NULL on error
Notes:
     (1) Adds hitmiss Sels for the T-junction of two lines.
         If the lines are very thin, they must be nearly orthogonal
         to register.
     (2) The number of Sels generated is 4 * norient.
     (3) It is suggested that hlsize be chosen at least 1 greater
         than mdist.  Try values of (hlsize, mdist) such as
         (6,5), (7,6), (8,7), (9,7), etc.

Definition at line 563 of file sel2.c.

References generatePtaLineFromPt(), L_BUF_SIZE, L_INSERT, L_SET_PIXELS, lept_mkdir(), pixaAddPix(), pixaCreate(), pixaDisplayTiledAndScaled(), pixaGetPixDimensions(), pixCreate(), pixDestroy(), pixPaintThroughMask(), pixRenderPta(), pixScaleBySampling(), pixSetAll(), pixSetPixel(), ptaDestroy(), ptaJoin(), selaAddSel(), selaCreate(), and selCreateFromColorPix().

◆ selMakePlusSign()

SEL* selMakePlusSign ( l_int32  size,
l_int32  linewidth 
)

selMakePlusSign()

Parameters
[in]sizeside of containing square
[in]linewidthof lines
Returns
sel, or NULL on error
Notes:
     (1) Useful for debugging to show location of selected pixels.
     (2) See displaySelectedPixels() for an example of use.

Definition at line 878 of file sel2.c.

References L_SET_PIXELS, pixCreate(), pixDestroy(), pixRenderLine(), and selCreateFromPix().

Variable Documentation

◆ basic_linear

const l_int32 basic_linear[]
static
Initial value:
= {2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 20, 21, 25, 30, 31, 35, 40, 41, 45, 50, 51}

Definition at line 76 of file sel2.c.

◆ sel_48_1

const char* sel_48_1
static
Initial value:
= " xx"
"oCx"
"oo "

Definition at line 744 of file sel2.c.

◆ sel_48_2

const char* sel_48_2
static
Initial value:
= "o x"
"oCx"
"o x"

Definition at line 747 of file sel2.c.

◆ sel_4_1

const char* sel_4_1
static
Initial value:
= " x"
"oCx"
" x"

Definition at line 686 of file sel2.c.

◆ sel_4_2

const char* sel_4_2
static
Initial value:
= " x"
"oCx"
" o "

Definition at line 689 of file sel2.c.

◆ sel_4_3

const char* sel_4_3
static
Initial value:
= " o "
"oCx"
" x"

Definition at line 692 of file sel2.c.

◆ sel_4_4

const char* sel_4_4
static
Initial value:
= " o "
"oCx"
" o "

Definition at line 695 of file sel2.c.

◆ sel_4_5

const char* sel_4_5
static
Initial value:
= " ox"
"oCx"
" o "

Definition at line 698 of file sel2.c.

◆ sel_4_6

const char* sel_4_6
static
Initial value:
= " o "
"oCx"
" ox"

Definition at line 701 of file sel2.c.

◆ sel_4_7

const char* sel_4_7
static
Initial value:
= " xx"
"oCx"
" o "

Definition at line 704 of file sel2.c.

◆ sel_4_8

const char* sel_4_8
static
Initial value:
= " x"
"oCx"
"o x"

Definition at line 707 of file sel2.c.

◆ sel_4_9

const char* sel_4_9
static
Initial value:
= "o x"
"oCx"
" x"

Definition at line 710 of file sel2.c.

◆ sel_8_1

const char* sel_8_1
static
Initial value:
= " x "
"oCx"
" x "

Definition at line 715 of file sel2.c.

◆ sel_8_2

const char* sel_8_2
static
Initial value:
= " x "
"oCx"
"o "

Definition at line 718 of file sel2.c.

◆ sel_8_3

const char* sel_8_3
static
Initial value:
= "o "
"oCx"
" x "

Definition at line 721 of file sel2.c.

◆ sel_8_4

const char* sel_8_4
static
Initial value:
= "o "
"oCx"
"o "

Definition at line 724 of file sel2.c.

◆ sel_8_5

const char* sel_8_5
static
Initial value:
= "o x"
"oCx"
"o "

Definition at line 727 of file sel2.c.

◆ sel_8_6

const char* sel_8_6
static
Initial value:
= "o "
"oCx"
"o x"

Definition at line 730 of file sel2.c.

◆ sel_8_7

const char* sel_8_7
static
Initial value:
= " x "
"oCx"
"oo "

Definition at line 733 of file sel2.c.

◆ sel_8_8

const char* sel_8_8
static
Initial value:
= " x "
"oCx"
"ox "

Definition at line 736 of file sel2.c.

◆ sel_8_9

const char* sel_8_9
static
Initial value:
= "ox "
"oCx"
" x "

Definition at line 739 of file sel2.c.