Leptonica  1.83.1
Image processing and image analysis suite
pixafunc2.c File Reference
#include <string.h>
#include <math.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

PIXpixaDisplay (PIXA *pixa, l_int32 w, l_int32 h)
 
PIXpixaDisplayRandomCmap (PIXA *pixa, l_int32 w, l_int32 h)
 
PIXpixaDisplayLinearly (PIXA *pixas, l_int32 direction, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border, BOXA **pboxa)
 
PIXpixaDisplayOnLattice (PIXA *pixa, l_int32 cellw, l_int32 cellh, l_int32 *pncols, BOXA **pboxa)
 
PIXpixaDisplayUnsplit (PIXA *pixa, l_int32 nx, l_int32 ny, l_int32 borderwidth, l_uint32 bordercolor)
 
PIXpixaDisplayTiled (PIXA *pixa, l_int32 maxwidth, l_int32 background, l_int32 spacing)
 
PIXpixaDisplayTiledInRows (PIXA *pixa, l_int32 outdepth, l_int32 maxwidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border)
 
PIXpixaDisplayTiledInColumns (PIXA *pixas, l_int32 nx, l_float32 scalefactor, l_int32 spacing, l_int32 border)
 
PIXpixaDisplayTiledAndScaled (PIXA *pixa, l_int32 outdepth, l_int32 tilewidth, l_int32 ncols, l_int32 background, l_int32 spacing, l_int32 border)
 
PIXpixaDisplayTiledWithText (PIXA *pixa, l_int32 maxwidth, l_float32 scalefactor, l_int32 spacing, l_int32 border, l_int32 fontsize, l_uint32 textcolor)
 
PIXpixaDisplayTiledByIndex (PIXA *pixa, NUMA *na, l_int32 width, l_int32 spacing, l_int32 border, l_int32 fontsize, l_uint32 textcolor)
 
PIXpixaDisplayPairTiledInColumns (PIXA *pixas1, PIXA *pixas2, l_int32 nx, l_float32 scalefactor, l_int32 spacing1, l_int32 spacing2, l_int32 border1, l_int32 border2, l_int32 fontsize, l_int32 startindex, SARRAY *sa)
 
PIXpixaaDisplay (PIXAA *paa, l_int32 w, l_int32 h)
 
PIXpixaaDisplayByPixa (PIXAA *paa, l_int32 maxnx, l_float32 scalefactor, l_int32 hspacing, l_int32 vspacing, l_int32 border)
 
PIXApixaaDisplayTiledAndScaled (PIXAA *paa, l_int32 outdepth, l_int32 tilewidth, l_int32 ncols, l_int32 background, l_int32 spacing, l_int32 border)
 
PIXApixaConvertTo1 (PIXA *pixas, l_int32 thresh)
 
PIXApixaConvertTo8 (PIXA *pixas, l_int32 cmapflag)
 
PIXApixaConvertTo8Colormap (PIXA *pixas, l_int32 dither)
 
PIXApixaConvertTo32 (PIXA *pixas)
 
PIXApixaConstrainedSelect (PIXA *pixas, l_int32 first, l_int32 last, l_int32 nmax, l_int32 use_pairs, l_int32 copyflag)
 
l_ok pixaSelectToPdf (PIXA *pixas, l_int32 first, l_int32 last, l_int32 res, l_float32 scalefactor, l_int32 type, l_int32 quality, l_uint32 color, l_int32 fontsize, const char *fileout)
 
PIXApixaMakeFromTiledPixa (PIXA *pixas, l_int32 w, l_int32 h, l_int32 nsamp)
 
PIXApixaMakeFromTiledPix (PIX *pixs, l_int32 w, l_int32 h, l_int32 start, l_int32 num, BOXA *boxa)
 
l_ok pixGetTileCount (PIX *pix, l_int32 *pn)
 
PIXApixaDisplayMultiTiled (PIXA *pixas, l_int32 nx, l_int32 ny, l_int32 maxw, l_int32 maxh, l_float32 scalefactor, l_int32 spacing, l_int32 border)
 
l_ok pixaSplitIntoFiles (PIXA *pixas, l_int32 nsplit, l_float32 scale, l_int32 outwidth, l_int32 write_pixa, l_int32 write_pix, l_int32 write_pdf)
 
l_ok convertToNUpFiles (const char *dir, const char *substr, l_int32 nx, l_int32 ny, l_int32 tw, l_int32 spacing, l_int32 border, l_int32 fontsize, const char *outdir)
 
PIXAconvertToNUpPixa (const char *dir, const char *substr, l_int32 nx, l_int32 ny, l_int32 tw, l_int32 spacing, l_int32 border, l_int32 fontsize)
 
PIXApixaConvertToNUpPixa (PIXA *pixas, SARRAY *sa, l_int32 nx, l_int32 ny, l_int32 tw, l_int32 spacing, l_int32 border, l_int32 fontsize)
 
l_ok pixaCompareInPdf (PIXA *pixa1, PIXA *pixa2, l_int32 nx, l_int32 ny, l_int32 tw, l_int32 spacing, l_int32 border, l_int32 fontsize, const char *fileout)
 

Detailed Description


     Pixa display (render into a pix)
          PIX      *pixaDisplay()
          PIX      *pixaDisplayRandomCmap()
          PIX      *pixaDisplayLinearly()
          PIX      *pixaDisplayOnLattice()
          PIX      *pixaDisplayUnsplit()
          PIX      *pixaDisplayTiled()
          PIX      *pixaDisplayTiledInRows()
          PIX      *pixaDisplayTiledInColumns()
          PIX      *pixaDisplayTiledAndScaled()
          PIX      *pixaDisplayTiledWithText()
          PIX      *pixaDisplayTiledByIndex()

     Pixa pair display (render into a pix)
          PIX      *pixaDisplayPairTiledInColumns()

     Pixaa display (render into a pix)
          PIX      *pixaaDisplay()
          PIX      *pixaaDisplayByPixa()
          PIXA     *pixaaDisplayTiledAndScaled()

     Conversion of all pix to specified type (e.g., depth)
          PIXA     *pixaConvertTo1()
          PIXA     *pixaConvertTo8()
          PIXA     *pixaConvertTo8Colormap()
          PIXA     *pixaConvertTo32()

     Pixa constrained selection and pdf generation
          PIXA     *pixaConstrainedSelect()
          l_int32   pixaSelectToPdf()

     Generate pixa from tiled images
          PIXA     *pixaMakeFromTiledPixa()
          PIXA     *pixaMakeFromTiledPix()
          l_int32   pixGetTileCount()

     Pixa display into multiple tiles
          PIXA     *pixaDisplayMultiTiled()

     Split pixa into files
          l_int32   pixaSplitIntoFiles()

     Tile N-Up
          l_int32   convertToNUpFiles()
          PIXA     *convertToNUpPixa()
          PIXA     *pixaConvertToNUpPixa()

     Render two pixa side-by-side for comparison                   *
          l_int32   pixaCompareInPdf()

 We give twelve pixaDisplay*() methods for tiling a pixa in a pix.
 Some work for 1 bpp input; others for any input depth.
 Some give an output depth that depends on the input depth;
 others give a different output depth or allow you to choose it.
 Some use a boxes to determine where each pix goes; others tile
 onto a regular lattice; others tile onto an irregular lattice;
 one uses an associated index array to determine which column
 each pix goes into.

 Here is a brief description of what the pixa display functions do.

   pixaDisplay()
       This uses the boxes in the pixa to lay out each pix.  This
       can be used to reconstruct a pix that has been broken into
       components, if the boxes represents the positions of the
       components in the original image.
   pixaDisplayRandomCmap()
       This also uses the boxes to lay out each pix.  However, it creates
       a colormapped dest, where each 1 bpp pix is given a randomly
       generated color (up to 256 are used).
   pixaDisplayLinearly()
       This puts each pix, sequentially, in a line, either horizontally
       or vertically.
   pixaDisplayOnLattice()
       This puts each pix, sequentially, onto a regular lattice,
       omitting any pix that are too big for the lattice size.
       This is useful, for example, to store bitmapped fonts,
       where all the characters are stored in a single image.
   pixaDisplayUnsplit()
       This lays out a mosaic of tiles (the pix in the pixa) that
       are all of equal size.  (Don't use this for unequal sized pix!)
       For example, it can be used to invert the action of
       pixaSplitPix().
   pixaDisplayTiled()
       Like pixaDisplayOnLattice(), this places each pix on a regular
       lattice, but here the lattice size is determined by the
       largest component, and no components are omitted.  This is
       dangerous if there are thousands of small components and
       one or more very large one, because the size of the resulting
       pix can be huge!
   pixaDisplayTiledInRows()
       This puts each pix down in a series of rows, where the upper
       edges of each pix in a row are aligned and there is a uniform
       spacing between the pix.  The height of each row is determined
       by the tallest pix that was put in the row.  This function
       is a reasonably efficient way to pack the subimages.
       A boxa of the locations of each input pix is stored in the output.
   pixaDisplayTiledInColumns()
       This puts each pix down in a series of rows, each row having
       a specified number of pix.  The upper edges of each pix in a
       row are aligned and there is a uniform spacing between the pix.
       The height of each row is determined by the tallest pix that
       was put in the row.  A boxa of the locations of each input
       pix is stored in the output.
   pixaDisplayTiledAndScaled()
       This scales each pix to a given width and output depth, and then
       tiles them in rows with a given number placed in each row.
       This is useful for presenting a sequence of images that can be
       at different resolutions, but which are derived from the same
       initial image.
   pixaDisplayTiledWithText()
       This is a version of pixaDisplayTiledInRows() that prints, below
       each pix, the text in the pix text field.  It renders a pixa
       to an image with white background that does not exceed a
       given value in width.
   pixaDisplayTiledByIndex()
       This scales each pix to a given width and output depth,
       and then tiles them in columns corresponding to the value
       in an associated numa.  All pix with the same index value are
       rendered in the same column.  Text in the pix text field are
       rendered below the pix.

 To render mosaics of images in a pixaa, display functions are
 provided that handle situations where the images are all scaled to
 the same size, or the number of images on each row needs to vary.

Definition in file pixafunc2.c.

Function Documentation

◆ convertToNUpFiles()

l_ok convertToNUpFiles ( const char *  dir,
const char *  substr,
l_int32  nx,
l_int32  ny,
l_int32  tw,
l_int32  spacing,
l_int32  border,
l_int32  fontsize,
const char *  outdir 
)

convertToNUpFiles()

Parameters
[in]dirfull path to directory of images
[in]substr[optional] can be null
[in]nx,nyin [1, ... 50], tiling factors in each direction
[in]twtarget width, in pixels; must be >= 20
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
[in]fontsizeto print tail of filename with image. Valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
[in]outdirsubdirectory of /tmp to put N-up tiled images
Returns
0 if OK, 1 on error
Notes:
     (1) Each set of nx * ny images is scaled and tiled into a single
         image, that is written out to outdir.
     (2) All images in each nx * ny set are scaled to the same
         width, tw.  This is typically used when all images are
         roughly the same size.
     (3) This is useful for generating a pdf from the set of input
         files, where each page is a tile of (nx * ny) input images.
         Typical values for nx and ny are in the range [2 ... 5].
     (4) If fontsize != 0, each image has the tail of its filename
         rendered below it.

Definition at line 2426 of file pixafunc2.c.

References convertToNUpPixa(), lept_mkdir(), lept_rmdir(), and pixaGetRenderingDepth().

◆ convertToNUpPixa()

PIXA* convertToNUpPixa ( const char *  dir,
const char *  substr,
l_int32  nx,
l_int32  ny,
l_int32  tw,
l_int32  spacing,
l_int32  border,
l_int32  fontsize 
)

convertToNUpPixa()

Parameters
[in]dirfull path to directory of images
[in]substr[optional] can be null
[in]nx,nyin [1, ... 50], tiling factors in each direction
[in]twtarget width, in pixels; must be >= 20
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
[in]fontsizeto print tail of filename with image. Valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
Returns
pixad, or NULL on error
Notes:
     (1) See notes for convertToNUpFiles()

Definition at line 2486 of file pixafunc2.c.

References getSortedPathnamesInDirectory(), L_INSERT, L_NOCOPY, pixaConvertToNUpPixa(), pixaDestroy(), pixaReadFilesSA(), sarrayAddString(), sarrayCreate(), sarrayDestroy(), sarrayGetCount(), sarrayGetString(), and splitPathAtDirectory().

Referenced by convertToNUpFiles().

◆ pixaaDisplay()

PIX* pixaaDisplay ( PIXAA paa,
l_int32  w,
l_int32  h 
)

pixaaDisplay()

Parameters
[in]paa
[in]w,hif set to 0, the size is determined from the bounding box of the components in pixa
Returns
pix, or NULL on error
Notes:
     (1) Each pix of the paa is displayed at the location given by
         its box, translated by the box of the containing pixa
         if it exists.

Definition at line 1543 of file pixafunc2.c.

References boxaDestroy(), boxaGetCount(), boxaGetExtent(), L_CLONE, pixaaGetBoxa(), pixaaGetCount(), pixaaGetPixa(), pixaDestroy(), pixaGetBoxa(), and pixaGetPix().

◆ pixaaDisplayByPixa()

PIX* pixaaDisplayByPixa ( PIXAA paa,
l_int32  maxnx,
l_float32  scalefactor,
l_int32  hspacing,
l_int32  vspacing,
l_int32  border 
)

pixaaDisplayByPixa()

Parameters
[in]paa
[in]maxnxmaximum number of columns for rendering each pixa
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]hspacingbetween images on a row (in the pixa)
[in]vspacingbetween tiles rows, each corresponding to a pixa
[in]borderwidth of black border added to each image; use 0 for no border
Returns
pixd of images in paa, tiled by pixa in row-major order
Notes:
     (1) This renders a pixaa into a single image.  The pix from each pixa
         are rendered on a row.  If the number of pix in the pixa is
         larger than maxnx, the pix will be rendered into more than 1 row.
         To insure that each pixa is rendered into one row, use maxnx
         at least as large as the max number of pix in the pixa.
     (2) Each row is tiled such that the top of each pix is aligned and
         each pix is separated by hspacing from the next one.
         A black border can be added to each pix.
     (3) The resulting pix from each row are then rendered vertically,
         separated by vspacing from each other.
     (4) The output depth is determined by the largest depth of all
         the pix in paa. Colormaps are removed.

Definition at line 1644 of file pixafunc2.c.

References L_CLONE, L_INSERT, pixaAddPix(), pixaaGetCount(), pixaaGetPixa(), pixaCreate(), pixaDestroy(), and pixaDisplayTiledInColumns().

Referenced by recogDebugAverages(), and recogShowContent().

◆ pixaaDisplayTiledAndScaled()

PIXA* pixaaDisplayTiledAndScaled ( PIXAA paa,
l_int32  outdepth,
l_int32  tilewidth,
l_int32  ncols,
l_int32  background,
l_int32  spacing,
l_int32  border 
)

pixaaDisplayTiledAndScaled()

Parameters
[in]paa
[in]outdepthoutput depth: 1, 8 or 32 bpp
[in]tilewidtheach pix is scaled to this width
[in]ncolsnumber of tiles in each row
[in]background0 for white, 1 for black; this is the color of the spacing between the images
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
Returns
pixa of tiled images, one image for each pixa in the paa, or NULL on error
Notes:
     (1) For each pixa, this generates from all the pix a
         tiled/scaled output pix, and puts it in the output pixa.
     (2) See comments in pixaDisplayTiledAndScaled().

Definition at line 1705 of file pixafunc2.c.

References L_CLONE, L_INSERT, pixaAddPix(), pixaaGetCount(), pixaaGetPixa(), pixaCreate(), pixaDestroy(), and pixaDisplayTiledAndScaled().

◆ pixaCompareInPdf()

l_ok pixaCompareInPdf ( PIXA pixa1,
PIXA pixa2,
l_int32  nx,
l_int32  ny,
l_int32  tw,
l_int32  spacing,
l_int32  border,
l_int32  fontsize,
const char *  fileout 
)

pixaCompareInPdf()

Parameters
[in]pixa1
[in]pixa2
[in]nx,nyin [1, ... 20], tiling factors in each direction
[in]twtarget width, in pixels; must be >= 20
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image and on each pair; use 0 for no border
[in]fontsizeto print index of each pair of images. Valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
[in]fileoutoutput pdf file
Returns
0 if OK, 1 on error
Notes:
     (1) This takes two pixa and renders them interleaved, side-by-side
         in a pdf.  A warning is issued if the input pixa arrays
         have different lengths.
     (2) nx and ny specify how many side-by-side pairs are displayed
         on each pdf page.  For example, if nx = 1 and ny = 2, then
         two pairs are shown, one above the other, on each page.
     (3) The input pix are scaled to a target width of tw, and
         then paired with optional spacing between and optional
         black border of width border.
     (4) After a pixa is generated of these tiled images, it is
         written to fileout as a pdf.
     (5) Typical numbers for the input parameters are:
           nx = small integer (1 - 4)
           ny = 2 * nx
           tw = 200 - 500 pixels
           spacing = 10
           border = 2
           fontsize = 10
     (6) If fontsize != 0, the index of the pix pair in their pixa
         is printed out below each pair.

Definition at line 2661 of file pixafunc2.c.

References L_CLONE, pixaConvertToNUpPixa(), pixaConvertToPdf(), pixaDestroy(), pixaGetCount(), pixaInterleave(), sarrayDestroy(), and sarrayGenerateIntegers().

◆ pixaConstrainedSelect()

PIXA* pixaConstrainedSelect ( PIXA pixas,
l_int32  first,
l_int32  last,
l_int32  nmax,
l_int32  use_pairs,
l_int32  copyflag 
)

pixaConstrainedSelect()

Parameters
[in]pixas
[in]firstfirst index to choose; >= 0
[in]lastbiggest possible index to reach; use -1 to go to the end; otherwise, last >= first
[in]nmaxmaximum number of pix to select; > 0
[in]use_pairs1 = select pairs of adjacent pix; 0 = select individual pix
[in]copyflagL_COPY, L_CLONE
Returns
pixad if OK, NULL on error
Notes:
    (1) See notes in genConstrainedNumaInRange() for how selection
        is made.
    (2) This returns a selection of the pix in the input pixa.
    (3) Use copyflag == L_COPY if you don't want changes in the pix
        in the returned pixa to affect those in the input pixa.

Definition at line 1922 of file pixafunc2.c.

References genConstrainedNumaInRange(), L_INSERT, numaDestroy(), numaGetCount(), numaGetIValue(), pixaAddPix(), pixaCreate(), pixaGetCount(), and pixaGetPix().

◆ pixaConvertTo1()

PIXA* pixaConvertTo1 ( PIXA pixas,
l_int32  thresh 
)

pixaConvertTo1()

Parameters
[in]pixas
[in]threshthreshold for final binarization from 8 bpp gray
Returns
pixad, or NULL on error

Definition at line 1753 of file pixafunc2.c.

References L_CLONE, L_COPY, L_INSERT, pixaAddPix(), pixaCreate(), pixaGetBoxa(), pixaGetCount(), pixaGetPix(), pixaSetBoxa(), pixConvertTo1(), and pixDestroy().

◆ pixaConvertTo32()

PIXA* pixaConvertTo32 ( PIXA pixas)

pixaConvertTo32()

Parameters
[in]pixas
Returns
pixad 32 bpp rgb, or NULL on error
Notes:
     (1) See notes for pixConvertTo32(), applied to each pix in pixas.
     (2) This can be used to allow 1 bpp pix in a pixa to be displayed
         with color.

Definition at line 1871 of file pixafunc2.c.

References L_CLONE, L_COPY, L_INSERT, pixaAddPix(), pixaCreate(), pixaGetBoxa(), pixaGetCount(), pixaGetPix(), pixaSetBoxa(), pixConvertTo32(), and pixDestroy().

◆ pixaConvertTo8()

PIXA* pixaConvertTo8 ( PIXA pixas,
l_int32  cmapflag 
)

pixaConvertTo8()

Parameters
[in]pixas
[in]cmapflag1 to give pixd a colormap; 0 otherwise
Returns
pixad each pix is 8 bpp, or NULL on error
Notes:
     (1) See notes for pixConvertTo8(), applied to each pix in pixas.

Definition at line 1792 of file pixafunc2.c.

References L_CLONE, L_COPY, L_INSERT, pixaAddPix(), pixaCreate(), pixaGetBoxa(), pixaGetCount(), pixaGetPix(), pixaSetBoxa(), pixConvertTo8(), and pixDestroy().

◆ pixaConvertTo8Colormap()

PIXA* pixaConvertTo8Colormap ( PIXA pixas,
l_int32  dither 
)

pixaConvertTo8Colormap()

Parameters
[in]pixas
[in]dither1 to dither if necessary; 0 otherwise
Returns
pixad each pix is 8 bpp, or NULL on error
Notes:
     (1) See notes for pixConvertTo8Colormap(), applied to each pix in pixas.

Definition at line 1831 of file pixafunc2.c.

References L_CLONE, L_COPY, L_INSERT, pixaAddPix(), pixaCreate(), pixaGetBoxa(), pixaGetCount(), pixaGetPix(), pixaSetBoxa(), pixConvertTo8Colormap(), and pixDestroy().

◆ pixaConvertToNUpPixa()

PIXA* pixaConvertToNUpPixa ( PIXA pixas,
SARRAY sa,
l_int32  nx,
l_int32  ny,
l_int32  tw,
l_int32  spacing,
l_int32  border,
l_int32  fontsize 
)

pixaConvertToNUpPixa()

Parameters
[in]pixas
[in]sa[optional] array of strings associated with each pix
[in]nx,nyin [1, ... 50], tiling factors in each direction
[in]twtarget width, in pixels; must be >= 20
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
[in]fontsizeto print string with each image. Valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
Returns
pixad, or NULL on error
Notes:
     (1) This takes an input pixa and an optional array of strings, and
         generates a pixa of NUp tiles from the input, labeled with
         the strings if they exist and fontsize != 0.
     (2) See notes for convertToNUpFiles()

Definition at line 2550 of file pixafunc2.c.

References bmfCreate(), bmfDestroy(), L_ADD_BELOW, L_CLONE, L_INSERT, L_NOCOPY, pixaAddPix(), pixaCreate(), pixAddTextlines(), pixaDestroy(), pixaDisplayTiledAndScaled(), pixaGetCount(), pixaGetPix(), pixaGetRenderingDepth(), pixClone(), pixDestroy(), pixScaleToSize(), sarrayGetCount(), and sarrayGetString().

Referenced by convertToNUpPixa(), and pixaCompareInPdf().

◆ pixaDisplay()

PIX* pixaDisplay ( PIXA pixa,
l_int32  w,
l_int32  h 
)

pixaDisplay()

Parameters
[in]pixa
[in]w,hif set to 0, the size is determined from the bounding box of the components in pixa
Returns
pix, or NULL on error
Notes:
     (1) This uses the boxes to place each pix in the rendered composite.
     (2) Set w = h = 0 to use the b.b. of the components to determine
         the size of the returned pix.
     (3) Uses the first pix in pixa to determine the depth.
     (4) The background is written "white".  On 1 bpp, each successive
         pix is "painted" (adding foreground), whereas for grayscale
         or color each successive pix is blitted with just the src.
     (5) If the pixa is empty, returns an empty 1 bpp pix.

Definition at line 191 of file pixafunc2.c.

References boxaDestroy(), boxaGetExtent(), L_CLONE, pixaGetBoxa(), pixaGetCount(), pixaGetPix(), and pixCreate().

Referenced by pixaDisplayTiledByIndex(), pixSelectByArea(), pixSelectByAreaFraction(), pixSelectByPerimSizeRatio(), pixSelectByPerimToAreaRatio(), pixSelectBySize(), pixSelectByWidthHeightRatio(), and wshedRenderColors().

◆ pixaDisplayLinearly()

PIX* pixaDisplayLinearly ( PIXA pixas,
l_int32  direction,
l_float32  scalefactor,
l_int32  background,
l_int32  spacing,
l_int32  border,
BOXA **  pboxa 
)

pixaDisplayLinearly()

Parameters
[in]pixas
[in]directionL_HORIZ or L_VERT
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]background0 for white, 1 for black; this is the color of the spacing between the images
[in]spacingbetween images, and on outside
[in]borderwidth of black border added to each image; use 0 for no border
[out]pboxa[optional] location of images in output pix
Returns
pix of composite images, or NULL on error
Notes:
     (1) This puts each pix, sequentially, in a line, either horizontally
         or vertically.
     (2) If any pix has a colormap, all pix are rendered in rgb.
     (3) The boxa gives the location of each image.

Definition at line 339 of file pixafunc2.c.

◆ pixaDisplayMultiTiled()

PIXA* pixaDisplayMultiTiled ( PIXA pixas,
l_int32  nx,
l_int32  ny,
l_int32  maxw,
l_int32  maxh,
l_float32  scalefactor,
l_int32  spacing,
l_int32  border 
)

pixaDisplayMultiTiled()

Parameters
[in]pixas
[in]nx,nyin [1, ... 50], tiling factors in each direction
[in]maxw,maxhmax sizes to keep
[in]scalefactorscale each image by this
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
Returns
pixad if OK, NULL on error
Notes:
     (1) Each set of nx * ny images is optionally scaled and saved
         into a new pix, and then aggregated.
     (2) Set maxw = maxh = 0 if you want to include all pix from pixs.
     (3) This is useful for generating a pdf from the output pixa, where
         each page is a tile of (nx * ny) images from the input pixa.

Definition at line 2262 of file pixafunc2.c.

References L_CLONE, L_COPY, L_INSERT, L_SELECT_IF_BOTH, L_SELECT_IF_LTE, pixaAddPix(), pixaCopy(), pixaCreate(), pixaDestroy(), pixaDisplayTiledInColumns(), pixaGetCount(), pixaGetPix(), and pixaSelectBySize().

◆ pixaDisplayOnLattice()

PIX* pixaDisplayOnLattice ( PIXA pixa,
l_int32  cellw,
l_int32  cellh,
l_int32 *  pncols,
BOXA **  pboxa 
)

pixaDisplayOnLattice()

Parameters
[in]pixa
[in]cellwlattice cell width
[in]cellhlattice cell height
[out]pncols[optional] number of columns in output lattice
[out]pboxa[optional] location of images in lattice
Returns
pix of composite images, or NULL on error
Notes:
     (1) This places each pix on sequentially on a regular lattice
         in the rendered composite.  If a pix is too large to fit in the
         allocated lattice space, it is not rendered.
     (2) If any pix has a colormap, all pix are rendered in rgb.
     (3) This is useful when putting bitmaps of components,
         such as characters, into a single image.
     (4) Save the number of tiled images in the text field of the pix,
         in the format: n = d.  This survives write/read into png files,
         for example.
     (5) The boxa gives the location of each image.  The UL corner
         of each image is on a lattice cell corner.  Omitted images
         (due to size) are assigned an invalid width and height of 0.

Definition at line 430 of file pixafunc2.c.

References L_CLONE, L_INSERT, pixaAddPix(), pixaAnyColormaps(), pixaCopy(), pixaCreate(), pixaGetCount(), pixaGetPix(), pixaVerifyDepth(), pixConvertTo32(), and pixDestroy().

◆ pixaDisplayPairTiledInColumns()

PIX* pixaDisplayPairTiledInColumns ( PIXA pixas1,
PIXA pixas2,
l_int32  nx,
l_float32  scalefactor,
l_int32  spacing1,
l_int32  spacing2,
l_int32  border1,
l_int32  border2,
l_int32  fontsize,
l_int32  startindex,
SARRAY sa 
)

pixaDisplayPairTiledInColumns()

Parameters
[in]pixas1
[in]pixas2
[in]nxnumber of columns in output image
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]spacing1between images within a pair
[in]spacing2between image pairs, and on outside
[in]border1width of black border added to each image; use 0 for no border
[in]border2width of black border added to each image pair. use 0 for no border
[in]fontsizeto print index below each pair. Valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
[in]startindexindex for the first pair; ignore if fontsize= 0
[in]sa[optional] array of text strings to display
Returns
pixd of tiled images, or NULL on error
Notes:
     (1) This renders a pair of pixa in a single image with &nx columns of
         tiled pairs.  The background color is white, and each row
         is tiled such that the top of each pix is aligned.
         The pix are displayed in pairs, taken from the input pixas.
         Input pixas1 and pixas2 must have the same count of pix.
     (2) If fontsize != 0, text is displayed below each pair, and the
         output depth is 32 bpp.  If sa is defined, the text is taken
         sequentially from sa; otherwise, an integer is displayed with
         numbers chosen consecutively starting with startindex.
     (3) If fontsize == 0, the output depth is determined by the largest
         depth required by the pix in the pixa.  Colormaps are removed.
     (4) Start with these values and tune for aesthetics:
           nx = 5, spacing1 = spacing2 = 15, border1 = border2 = 2,
           fontsize = 8.

Definition at line 1394 of file pixafunc2.c.

References L_CLONE, L_GET_BLACK_VAL, L_GET_WHITE_VAL, L_INSERT, L_INTEGER_VALUE, numaConvertToSarray(), numaDestroy(), numaMakeSequence(), pixaAddPix(), pixaCreate(), pixAddBlackOrWhiteBorder(), pixaDestroy(), pixaDisplayTiledInColumns(), pixaDisplayTiledWithText(), pixaGetCount(), pixaGetPix(), pixaGetRenderingDepth(), pixaSetText(), pixaSizeRange(), pixClone(), pixConvertTo32(), pixConvertTo8(), pixDestroy(), pixScale(), and sarrayDestroy().

◆ pixaDisplayRandomCmap()

PIX* pixaDisplayRandomCmap ( PIXA pixa,
l_int32  w,
l_int32  h 
)

pixaDisplayRandomCmap()

Parameters
[in]pixa1 bpp regions, with boxa delineating those regions
[in]w,hif set to 0, the size is determined from the bounding box of the components in pixa
Returns
pix 8 bpp, cmapped, with random colors assigned to each region, or NULL on error.
Notes:
     (1) This uses the boxes to place each pix in the rendered composite.
         The fg of each pix in pixa, such as a single connected
         component or a line of text, is given a random color.
     (2) By default, the background color is black (cmap index 0).
         This can be changed by pixcmapResetColor()

Definition at line 267 of file pixafunc2.c.

References boxaDestroy(), boxaGetExtent(), L_CLONE, pixaGetBoxa(), pixaGetBoxGeometry(), pixaGetCount(), pixaGetPix(), pixaVerifyDepth(), pixcmapCreateRandom(), pixCreate(), and pixSetColormap().

Referenced by wshedRenderColors().

◆ pixaDisplayTiled()

PIX* pixaDisplayTiled ( PIXA pixa,
l_int32  maxwidth,
l_int32  background,
l_int32  spacing 
)

pixaDisplayTiled()

Parameters
[in]pixa
[in]maxwidthof output image
[in]background0 for white, 1 for black
[in]spacing
Returns
pix of tiled images, or NULL on error
Notes:
     (1) This renders a pixa to a single image of width not to
         exceed maxwidth, with background color either white or black,
         and with each subimage spaced on a regular lattice.
     (2) The lattice size is determined from the largest width and height,
         separately, of all pix in the pixa.
     (3) All pix in the pixa must be of equal depth.
     (4) If any pix has a colormap, all pix are rendered in rgb.
     (5) Careful: because no components are omitted, this is
         dangerous if there are thousands of small components and
         one or more very large one, because the size of the
         resulting pix can be huge!

Definition at line 618 of file pixafunc2.c.

References L_CLONE, L_INSERT, pixaAddPix(), pixaAnyColormaps(), pixaCopy(), pixaCreate(), pixaDestroy(), pixaGetCount(), pixaGetDepthInfo(), pixaGetPix(), pixaSizeRange(), pixConvertTo32(), pixCreate(), pixDestroy(), and pixSetAll().

◆ pixaDisplayTiledAndScaled()

PIX* pixaDisplayTiledAndScaled ( PIXA pixa,
l_int32  outdepth,
l_int32  tilewidth,
l_int32  ncols,
l_int32  background,
l_int32  spacing,
l_int32  border 
)

pixaDisplayTiledAndScaled()

Parameters
[in]pixa
[in]outdepthoutput depth: 1, 8 or 32 bpp
[in]tilewidtheach pix is scaled to this width
[in]ncolsnumber of tiles in each row
[in]background0 for white, 1 for black; this is the color of the spacing between the images
[in]spacingbetween images, and on outside
[in]borderwidth of additional black border on each image; use 0 for no border
Returns
pix of tiled images, or NULL on error
Notes:
     (1) This can be used to tile a number of renderings of
         an image that are at different scales and depths.
     (2) Each image, after scaling and optionally adding the
         black border, has width 'tilewidth'.  Thus, the border does
         not affect the spacing between the image tiles.  The
         maximum allowed border width is tilewidth / 5.

Definition at line 1025 of file pixafunc2.c.

References L_CLONE, L_INSERT, pixaAddPix(), pixaCreate(), pixAddBorder(), pixaDestroy(), pixaGetCount(), pixaGetPix(), pixClone(), pixConvertTo1(), pixConvertTo32(), pixConvertTo8(), pixCreate(), pixDestroy(), pixGetDimensions(), pixScale(), pixScaleToGray(), and pixSetAll().

Referenced by pixaaDisplayTiledAndScaled(), pixacompDisplayTiledAndScaled(), pixaConvertToNUpPixa(), selaAddCrossJunctions(), and selaAddTJunctions().

◆ pixaDisplayTiledByIndex()

PIX* pixaDisplayTiledByIndex ( PIXA pixa,
NUMA na,
l_int32  width,
l_int32  spacing,
l_int32  border,
l_int32  fontsize,
l_uint32  textcolor 
)

pixaDisplayTiledByIndex()

Parameters
[in]pixa
[in]nanuma with indices corresponding to the pix in pixa
[in]widtheach pix is scaled to this width
[in]spacingbetween images, and on outside
[in]borderwidth of black border added to each image; use 0 for no border
[in]fontsize4, 6, ... 20
[in]textcolor0xrrggbb00
Returns
pixd of tiled images, or NULL on error
Notes:
     (1) This renders a pixa to a single image with white
         background color, where the pix are placed in columns
         given by the index value in the numa.  Each pix
         is separated by spacing from the adjacent ones, and
         an optional border is placed around them.
     (2) Up to 127 chars of text in the pix text field are rendered
         below each pix.  Use newlines in the text field to write
         the text in multiple lines that fit within the pix width.
     (3) To avoid having empty columns, if there are N different
         index values, they should be in [0 ... N-1].
     (4) All pix are converted to 32 bpp.

Definition at line 1272 of file pixafunc2.c.

References bmfCreate(), bmfDestroy(), boxCreate(), L_ADD_BELOW, L_CLONE, L_INSERT, lept_roundftoi(), numaDestroy(), numaGetCount(), numaGetIValue(), numaGetMax(), numaMakeConstant(), numaSetValue(), pixaAddBox(), pixaAddPix(), pixaCreate(), pixAddBorderGeneral(), pixAddTextlines(), pixaDestroy(), pixaDisplay(), pixaGetCount(), pixaGetPix(), pixClone(), pixConvertTo32(), pixDestroy(), pixGetDimensions(), pixGetText(), and pixScaleToSize().

◆ pixaDisplayTiledInColumns()

PIX* pixaDisplayTiledInColumns ( PIXA pixas,
l_int32  nx,
l_float32  scalefactor,
l_int32  spacing,
l_int32  border 
)

pixaDisplayTiledInColumns()

Parameters
[in]pixas
[in]nxnumber of columns in output image
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]spacingbetween images, and on outside; can be < 0
[in]borderwidth of black border added to each image; use 0 for no border
Returns
pixd of tiled images, or NULL on error
Notes:
     (1) This renders a pixa to a single image with &nx columns of
         subimages.  The background color is white, and each row
         is tiled such that the top of each pix is aligned and
         each pix is separated by 'spacing' from the next one.
         A black border can be added to each pix.
     (2) The output depth is determined by the largest depth
         required by the pix in the pixa.  Colormaps are removed.
     (3) A serialized boxa giving the location in pixd of each input
         pix (without added border) is stored in the text string of pixd.
         This allows, e.g., regeneration of a pixa from pixd, using
         pixaCreateFromBoxa().  If there is no scaling and the depth of
         each input pix in the pixa is the same, this tiling operation
         can be inverted using the boxa (except for loss of text in
         each of the input pix):
           pix1 = pixaDisplayTiledInColumns(pixa1, 3, 1.0, 0, 30, 2);
           char *boxatxt = pixGetText(pix1);
           boxa1 = boxaReadMem((l_uint8 *)boxatxt, strlen(boxatxt));
           pixa2 = pixaCreateFromBoxa(pix1, boxa1, NULL);

Definition at line 912 of file pixafunc2.c.

References L_CLONE, pixaConvertToSameDepth(), pixaCreate(), pixAddBorder(), pixaGetCount(), pixaGetDepthInfo(), pixaGetPix(), pixClone(), and pixScale().

Referenced by boxaReconcileAllByMedian(), pixaaDisplayByPixa(), pixaDisplayMultiTiled(), pixaDisplayPairTiledInColumns(), pixDisplayColorArray(), and pixMakeGamutRGB().

◆ pixaDisplayTiledInRows()

PIX* pixaDisplayTiledInRows ( PIXA pixa,
l_int32  outdepth,
l_int32  maxwidth,
l_float32  scalefactor,
l_int32  background,
l_int32  spacing,
l_int32  border 
)

pixaDisplayTiledInRows()

Parameters
[in]pixa
[in]outdepthoutput depth: 1, 8 or 32 bpp
[in]maxwidthof output image
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]background0 for white, 1 for black; this is the color of the spacing between the images
[in]spacingbetween images, and on outside
[in]borderwidth of black border added to each image; use 0 for no border
Returns
pixd of tiled images, or NULL on error
Notes:
     (1) This renders a pixa to a single image of width not to
         exceed maxwidth, with background color either white or black,
         and with each row tiled such that the top of each pix is
         aligned and separated by 'spacing' from the next one.
         A black border can be added to each pix.
     (2) All pix are converted to outdepth; existing colormaps are removed.
     (3) This does a reasonably spacewise-efficient job of laying
         out the individual pix images into a tiled composite.
     (4) A serialized boxa giving the location in pixd of each input
         pix (without added border) is stored in the text string of pixd.
         This allows, e.g., regeneration of a pixa from pixd, using
         pixaCreateFromBoxa().  If there is no scaling and the depth of
         each input pix in the pixa is the same, this tiling operation
         can be inverted using the boxa (except for loss of text in
         each of the input pix):
           pix1 = pixaDisplayTiledInRows(pixa1, 1, 1500, 1.0, 0, 30, 0);
           char *boxatxt = pixGetText(pix1);
           boxa1 = boxaReadMem((l_uint8 *)boxatxt, strlen(boxatxt));
           pixa2 = pixaCreateFromBoxa(pix1, boxa1, 0, 0, NULL);

Definition at line 730 of file pixafunc2.c.

References boxaCreate(), L_CLONE, L_INSERT, numaAddNumber(), numaCreate(), numaDestroy(), numaGetCount(), numaGetIValue(), pixaAddPix(), pixaCreate(), pixAddBorder(), pixaDestroy(), pixaGetCount(), pixaGetPix(), pixaGetPixDimensions(), pixClone(), pixConvertTo1(), pixConvertTo32(), pixConvertTo8(), pixCreate(), pixDestroy(), pixScale(), and pixSetAll().

Referenced by boxaCompareRegions(), boxaDisplayTiled(), dewarpaShowArrays(), pixaDisplayTiledWithText(), pixaSplitIntoFiles(), pixCompareGrayByHisto(), recogDisplayOutlier(), recogShowAverageTemplates(), recogShowMatch(), and selaDisplayInPix().

◆ pixaDisplayTiledWithText()

PIX* pixaDisplayTiledWithText ( PIXA pixa,
l_int32  maxwidth,
l_float32  scalefactor,
l_int32  spacing,
l_int32  border,
l_int32  fontsize,
l_uint32  textcolor 
)

pixaDisplayTiledWithText()

Parameters
[in]pixa
[in]maxwidthof output image
[in]scalefactorapplied to every pix; use 1.0 for no scaling
[in]spacingbetween images, and on outside
[in]borderwidth of black border added to each image; use 0 for no border
[in]fontsize4, 6, ... 20
[in]textcolor0xrrggbb00
Returns
pixd of tiled images, or NULL on error
Notes:
     (1) This is a version of pixaDisplayTiledInRows() that prints, below
         each pix, the text in the pix text field.  Up to 127 chars
         of text in the pix text field are rendered below each pix.
     (2) It renders a pixa to a single image of width not to
         exceed maxwidth, with white background color, with each row
         tiled such that the top of each pix is aligned and separated
         by spacing from the next one.
     (3) All pix are converted to 32 bpp.
     (4) This does a reasonably spacewise-efficient job of laying
         out the individual pix images into a tiled composite.

Definition at line 1178 of file pixafunc2.c.

References bmfCreate(), bmfDestroy(), L_ADD_BELOW, L_CLONE, L_INSERT, pixaAddPix(), pixaCreate(), pixAddBorderGeneral(), pixAddSingleTextblock(), pixaDestroy(), pixaDisplayTiledInRows(), pixaGetCount(), pixaGetPix(), pixaSizeRange(), pixClone(), pixConvertTo32(), pixDestroy(), and pixGetText().

Referenced by pixaDisplayPairTiledInColumns(), pixDisplayOutliers(), and recogMakeBootDigitTemplates().

◆ pixaDisplayUnsplit()

PIX* pixaDisplayUnsplit ( PIXA pixa,
l_int32  nx,
l_int32  ny,
l_int32  borderwidth,
l_uint32  bordercolor 
)

pixaDisplayUnsplit()

Parameters
[in]pixa
[in]nxnumber of mosaic cells horizontally
[in]nynumber of mosaic cells vertically
[in]borderwidthof added border on all sides
[in]bordercolorin our RGBA format: 0xrrggbbaa
Returns
pix of tiled images, or NULL on error
Notes:
     (1) This is a logical inverse of pixaSplitPix().  It
         constructs a pix from a mosaic of tiles, all of equal size.
     (2) For added generality, a border of arbitrary color can
         be added to each of the tiles.
     (3) In use, pixa will typically have either been generated
         from pixaSplitPix() or will derived from a pixa that
         was so generated.
     (4) All pix in the pixa must be of equal depth, and, if
         colormapped, have the same colormap.

Definition at line 545 of file pixafunc2.c.

References L_CLONE, PIX_SRC, pixaGetCount(), pixaGetPix(), pixaGetPixDimensions(), pixCopyColormap(), pixCreate(), pixDestroy(), pixRasterop(), and pixSetAllArbitrary().

◆ pixaMakeFromTiledPix()

PIXA* pixaMakeFromTiledPix ( PIX pixs,
l_int32  w,
l_int32  h,
l_int32  start,
l_int32  num,
BOXA boxa 
)

pixaMakeFromTiledPix()

Parameters
[in]pixsany depth; colormap OK
[in]wwidth of each tile
[in]hheight of each tile
[in]startfirst tile to use
[in]numnumber of tiles; use 0 to go to the end
[in]boxa[optional] location of rectangular regions to be extracted
Returns
pixa if OK, NULL on error
Notes:
     (1) Operations that generate a pix by tiling from a pixa, and
         the inverse that generate a pixa from tiles of a pix,
         are useful.  One such pair is pixaDisplayUnsplit() and
         pixaSplitPix().  This function is a very simple one that
         generates a pixa from tiles of a pix. There are two cases:
  • the tiles can all be the same size (the inverse of pixaDisplayOnLattice(), or
  • the tiles can differ in size, where there is an associated boxa (the inverse of pixaCreateFromBoxa(). (2) If all tiles are the same size, w by h, use boxa = NULL. If the tiles differ in size, use boxa to extract the individual images (w and h are then ignored). (3) If the pix was made by pixaDisplayOnLattice(), the number of tiled images is written into the text field, in the format n = <number>. (4) Typical usage: a set of character templates all scaled to the same size can be stored on a lattice of that size in a pix, and this function can regenerate the pixa. If the templates differ in size, a boxa generated when the tiled pix was made can be used to indicate the location of the templates.

Definition at line 2143 of file pixafunc2.c.

References pixaCreate(), pixaCreateFromBoxa(), pixGetDimensions(), and pixGetTileCount().

Referenced by pixaMakeFromTiledPixa().

◆ pixaMakeFromTiledPixa()

PIXA* pixaMakeFromTiledPixa ( PIXA pixas,
l_int32  w,
l_int32  h,
l_int32  nsamp 
)

pixaMakeFromTiledPixa()

Parameters
[in]pixasof mosaiced templates, one for each digit
[in]wwidth of samples (use 0 for default = 20)
[in]hheight of samples (use 0 for default = 30)
[in]nsampnumber of requested samples (use 0 for default = 100)
Returns
pixa of individual, scaled templates, or NULL on error
Notes:
     (1) This converts from a compressed representation of 1 bpp digit
         templates to a pixa where each pix has a single labeled template.
     (2) The mosaics hold 100 templates each, and the number of templates
         nsamp selected for each digit can be between 1 and 100.
     (3) Each mosaic has the number of images written in the text field,
         and the i-th pix contains samples of the i-th digit.  That value
         is written into the text field of each template in the output.

Definition at line 2065 of file pixafunc2.c.

References L_CLONE, pixaCreate(), pixaDestroy(), pixaGetPix(), pixaJoin(), pixaMakeFromTiledPix(), pixaSetText(), pixDestroy(), and pixGetTileCount().

◆ pixaSelectToPdf()

l_ok pixaSelectToPdf ( PIXA pixas,
l_int32  first,
l_int32  last,
l_int32  res,
l_float32  scalefactor,
l_int32  type,
l_int32  quality,
l_uint32  color,
l_int32  fontsize,
const char *  fileout 
)

pixaSelectToPdf()

Parameters
[in]pixas
[in]firstfirst index to choose; >= 0
[in]lastbiggest possible index to reach; use -1 to go to the end; otherwise, last >= first
[in]resoverride the resolution of each input image, in ppi; use 0 to respect the resolution embedded in the input
[in]scalefactorscaling factor applied to each image; > 0.0
[in]typeencoding type (L_JPEG_ENCODE, L_G4_ENCODE, L_FLATE_ENCODE, or 0 for default
[in]qualityused for JPEG only; 0 for default (75)
[in]colorof numbers added to each image (e.g., 0xff000000)
[in]fontsizeto print number below each image. The valid set is {4,6,8,10,12,14,16,18,20}. Use 0 to disable.
[in]fileoutpdf file of all images
Returns
0 if OK, 1 on error
Notes:
     (1) This writes a pdf of the selected images from pixas, one to
         a page.  They are optionally scaled and annotated with the
         index printed to the left of the image.
     (2) If the input images are 1 bpp and you want the numbers to be
         in color, first promote each pix to 8 bpp with a colormap:
               pixa1 = pixaConvertTo8(pixas, 1);
         and then call this function with the specified color

Definition at line 1988 of file pixafunc2.c.

References bmfCreate(), bmfDestroy(), L_ADD_LEFT, L_CLONE, L_FLATE_ENCODE, numaDestroy(), numaMakeSequence(), pixaAddTextNumber(), pixaConvertToPdf(), pixaCopy(), pixaDestroy(), pixaGetCount(), and pixaSelectRange().

◆ pixaSplitIntoFiles()

l_ok pixaSplitIntoFiles ( PIXA pixas,
l_int32  nsplit,
l_float32  scale,
l_int32  outwidth,
l_int32  write_pixa,
l_int32  write_pix,
l_int32  write_pdf 
)

pixaSplitIntoFiles()

Parameters
[in]pixas
[in]nsplitsplit pixas into this number of pixa; >= 2
[in]scalescalefactor applied to each pix
[in]outwidththe maxwidth parameter of tiled images for write_pix
[in]write_pixa1 to write the split pixa as separate files
[in]write_pix1 to write tiled images of the split pixa
[in]write_pdf1 to write pdfs of the split pixa
Returns
0 if OK, 1 on error
Notes:
     (1) For each requested output, nsplit files are written into
         directory /tmp/lept/split/.
     (2) This is useful when a pixa is so large that the images
         are not conveniently displayed as a single tiled image at
         full resolution.

Definition at line 2339 of file pixafunc2.c.

References L_CLONE, L_INSERT, lept_mkdir(), lept_stderr(), pixaAddPix(), pixaCreate(), pixaDisplayTiledInRows(), pixaGetCount(), pixaGetPix(), pixaWriteDebug(), pixDestroy(), and pixScale().

◆ pixGetTileCount()

l_ok pixGetTileCount ( PIX pix,
l_int32 *  pn 
)

pixGetTileCount()

Parameters
[in]pix
[out]*pnnumber embedded in pix text field
Returns
0 if OK, 1 on error
Notes:
     (1) If the pix was made by pixaDisplayOnLattice(), the number
         of tiled images is written into the text field, in the format
              n = <number>.
     (2) This returns 0 if the data is not in the text field, or on error.

Definition at line 2216 of file pixafunc2.c.

References pixGetText().

Referenced by pixaMakeFromTiledPix(), and pixaMakeFromTiledPixa().