Leptonica 1.68
C Image Processing Library
|
Interpreter for morphological operations, including binary expansion and reduction. More...
Go to the source code of this file.
Functions | |
PIX * | pixMorphSequence (PIX *pixs, const char *sequence, l_int32 dispsep) |
PIX * | pixMorphCompSequence (PIX *pixs, const char *sequence, l_int32 dispsep) |
PIX * | pixMorphSequenceDwa (PIX *pixs, const char *sequence, l_int32 dispsep) |
PIX * | pixMorphCompSequenceDwa (PIX *pixs, const char *sequence, l_int32 dispsep) |
l_int32 | morphSequenceVerify (SARRAY *sa) |
PIX * | pixGrayMorphSequence (PIX *pixs, const char *sequence, l_int32 dispsep, l_int32 dispy) |
PIX * | pixColorMorphSequence (PIX *pixs, const char *sequence, l_int32 dispsep, l_int32 dispy) |
Interpreter for morphological operations, including binary expansion and reduction.
Run a sequence of binary rasterop morphological operations PIX *pixMorphSequence() Run a sequence of binary composite rasterop morphological operations PIX *pixMorphCompSequence() Run a sequence of binary dwa morphological operations PIX *pixMorphSequenceDwa() Run a sequence of binary composite dwa morphological operations PIX *pixMorphCompSequenceDwa() Parser verifier for binary morphological operations l_int32 morphSequenceVerify() Run a sequence of grayscale morphological operations PIX *pixGrayMorphSequence() Run a sequence of color morphological operations PIX *pixColorMorphSequence()
Definition in file morphseq.c.
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) Return: pixd, or null on error
Notes: (1) This does rasterop morphology on binary images. (2) This runs a pipeline of operations; no branching is allowed. (3) This only uses brick Sels, which are created on the fly. In the future this will be generalized to extract Sels from a Sela by name. (4) A new image is always produced; the input image is not changed. (5) This contains an interpreter, allowing sequences to be generated and run. (6) The format of the sequence string is defined below. (7) In addition to morphological operations, rank order reduction and replicated expansion allow operations to take place downscaled by a power of 2. (8) Intermediate results can optionally be displayed. (9) Thanks to Dar-Shyang Lee, who had the idea for this and built the first implementation. (10) The sequence string is formatted as follows:
Definition at line 118 of file morphseq.c.
References ERROR_PTR, FREE, morphSequenceVerify(), NULL, pixAddBorder(), pixClone(), pixCloseSafeBrick(), pixCopy(), pixDestroy(), pixDilateBrick(), pixDisplay(), pixErodeBrick(), pixExpandReplicate(), pixOpenBrick(), pixReduceRankBinaryCascade(), pixRemoveBorder(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), and stringRemoveChars().
Referenced by DoPageSegmentation(), GetImageMask(), jbGetComponents(), main(), pixaGenerateFont(), pixColorsForQuantization(), pixDebugFlipDetect(), pixFindBaselines(), pixGenTextblockMask(), pixGetBackgroundGrayMap(), pixGetBackgroundRGBMap(), pixGetTextlineCenters(), pixItalicWords(), pixMaskedThreshOnBackgroundNorm(), pixMorphSequenceMasked(), pixUpDownDetectGeneral(), pixWordMaskByDilation(), and ptaGetBoundaryPixels().
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) Return: pixd, or null on error
Notes: (1) This does rasterop morphology on binary images, using composite operations for extra speed on large Sels. (2) Safe closing is used atomically. However, if you implement a closing as a sequence with a dilation followed by an erosion, it will not be safe, and to ensure that you have no boundary effects you must add a border in advance and remove it at the end. (3) For other usage details, see the notes for pixMorphSequence(). (4) The sequence string is formatted as follows:
Definition at line 298 of file morphseq.c.
References ERROR_PTR, FREE, morphSequenceVerify(), NULL, pixAddBorder(), pixClone(), pixCloseSafeCompBrick(), pixCopy(), pixDestroy(), pixDilateCompBrick(), pixDisplay(), pixErodeCompBrick(), pixExpandReplicate(), pixOpenCompBrick(), pixReduceRankBinaryCascade(), pixRemoveBorder(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), and stringRemoveChars().
Referenced by DoPageSegmentation(), main(), pixaMorphSequenceByComponent(), pixaMorphSequenceByRegion(), pixGenTextlineMask(), pixMirrorDetect(), and pixUpDownDetectGeneral().
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) Return: pixd, or null on error
Notes: (1) This does dwa morphology on binary images. (2) This runs a pipeline of operations; no branching is allowed. (3) This only uses brick Sels that have been pre-compiled with dwa code. (4) A new image is always produced; the input image is not changed. (5) This contains an interpreter, allowing sequences to be generated and run. (6) See pixMorphSequence() for further information about usage.
Definition at line 459 of file morphseq.c.
References ERROR_PTR, FREE, morphSequenceVerify(), NULL, pixAddBorder(), pixClone(), pixCloseBrickDwa(), pixCopy(), pixDestroy(), pixDilateBrickDwa(), pixDisplay(), pixErodeBrickDwa(), pixExpandReplicate(), pixOpenBrickDwa(), pixReduceRankBinaryCascade(), pixRemoveBorder(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), and stringRemoveChars().
Referenced by main(), pixMirrorDetectDwa(), and pixUpDownDetectGeneralDwa().
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) Return: pixd, or null on error
Notes: (1) This does dwa morphology on binary images, using brick Sels. (2) This runs a pipeline of operations; no branching is allowed. (3) It implements all brick Sels that have dimensions up to 63 on each side, using a composite (linear + comb) when useful. (4) A new image is always produced; the input image is not changed. (5) This contains an interpreter, allowing sequences to be generated and run. (6) See pixMorphSequence() for further information about usage.
Definition at line 620 of file morphseq.c.
References ERROR_PTR, FREE, morphSequenceVerify(), NULL, pixAddBorder(), pixClone(), pixCloseCompBrickDwa(), pixCopy(), pixDestroy(), pixDilateCompBrickDwa(), pixDisplay(), pixErodeCompBrickDwa(), pixExpandReplicate(), pixOpenCompBrickDwa(), pixReduceRankBinaryCascade(), pixRemoveBorder(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), and stringRemoveChars().
Referenced by main().
Input: sarray (of operation sequence) Return: TRUE if valid; FALSE otherwise or on error
Notes: (1) This does verification of valid binary morphological operation sequences. (2) See pixMorphSequence() for notes on valid operations in the sequence.
Definition at line 774 of file morphseq.c.
References ERROR_INT, FALSE, FREE, PROCNAME, sarrayGetCount(), sarrayGetString(), stringRemoveChars(), and TRUE.
Referenced by pixMorphCompSequence(), pixMorphCompSequenceDwa(), pixMorphSequence(), and pixMorphSequenceDwa().
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) dispy (if dispsep != 0, this gives the y-value of the UL corner for display; otherwise it is ignored) Return: pixd, or null on error
Notes: (1) This works on 8 bpp grayscale images. (2) This runs a pipeline of operations; no branching is allowed. (3) This only uses brick SELs. (4) A new image is always produced; the input image is not changed. (5) This contains an interpreter, allowing sequences to be generated and run. (6) The format of the sequence string is defined below. (7) In addition to morphological operations, the composite morph/subtract tophat can be performed. (8) Sel sizes (width, height) must each be odd numbers. (9) Intermediate results can optionally be displayed (10) The sequence string is formatted as follows:
Definition at line 944 of file morphseq.c.
References ERROR_PTR, FALSE, FREE, L_TOPHAT_BLACK, L_TOPHAT_WHITE, NULL, pixClone(), pixCloseGray(), pixCopy(), pixDestroy(), pixDilateGray(), pixDisplay(), pixErodeGray(), pixOpenGray(), pixTophat(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), stringRemoveChars(), and TRUE.
Referenced by main().
Input: pixs sequence (string specifying sequence) dispsep (horizontal separation in pixels between successive displays; use zero to suppress display) dispy (if dispsep != 0, this gives the y-value of the UL corner for display; otherwise it is ignored) Return: pixd, or null on error
Notes: (1) This works on 32 bpp rgb images. (2) Each component is processed separately. (3) This runs a pipeline of operations; no branching is allowed. (4) This only uses brick SELs. (5) A new image is always produced; the input image is not changed. (6) This contains an interpreter, allowing sequences to be generated and run. (7) Sel sizes (width, height) must each be odd numbers. (8) The format of the sequence string is defined below. (9) Intermediate results can optionally be displayed. (10) The sequence string is formatted as follows:
Definition at line 1151 of file morphseq.c.
References ERROR_PTR, FALSE, FREE, L_MORPH_CLOSE, L_MORPH_DILATE, L_MORPH_ERODE, L_MORPH_OPEN, NULL, pixClone(), pixColorMorph(), pixCopy(), pixDestroy(), pixDisplay(), PROCNAME, sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), sarraySplitString(), stringRemoveChars(), and TRUE.
Referenced by main().