Image-Leptonica

 view release on metacpan or  search on metacpan

lib/Image/Leptonica/Func/binreduce.pm  view on Meta::CPAN


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

  pixReduceRankBinaryCascade()

      Input:  pixs (1 bpp)
              level1, ... level 4 (thresholds, in the set {0, 1, 2, 3, 4})
      Return: pixd, or null on error

  Notes:
      (1) This performs up to four cascaded 2x rank reductions.
      (2) Use level = 0 to truncate the cascade.

=head1 AUTHOR

Zakariyya Mughal <zmughal@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Zakariyya Mughal.

This is free software; you can redistribute it and/or modify it under

lib/Image/Leptonica/Func/flipdetect.pm  view on Meta::CPAN

          If @npixels > 0, this removes HMT matches at the
          beginning and ending of "words."  This is useful for
          pages that may have mostly digits, because if npixels == 0,
          leading "1" and "3" digits can register as having
          ascenders or descenders, and "7" digits can match descenders.
          Consequently, a page image of only digits may register
          as being upside-down.
      (4) We want to count the number of instances found using the HMT.
          An expensive way to do this would be to count the
          number of connected components.  A cheap way is to do a rank
          reduction cascade that reduces each component to a single
          pixel, and results (after two or three 2x reductions)
          in one pixel for each of the original components.
          After the reduction, you have a much smaller pix over
          which to count pixels.  We do only 2 reductions, because
          this function is designed to work for input pix between
          150 and 300 ppi, and an 8x reduction on a 150 ppi image
          is going too far -- components will get merged.

=head2 pixUpDownDetectGeneralDwa

lib/Image/Leptonica/Func/ptra.pm  view on Meta::CPAN

      Return: 0 if OK, 1 on error

  Notes:
      (1) This checks first to see if the location is valid, and
          then if there is presently an item there.  If there is not,
          it is simply inserted into that location.
      (2) If there is an item at the insert location, items must be
          moved down to make room for the insert.  In the downward
          shift there are three options, given by @shiftflag.
            - If @shiftflag == L_AUTO_DOWNSHIFT, a decision is made
              whether, in a cascade of items, to downshift a minimum
              amount or for all items above @index.  The decision is
              based on the expectation of finding holes (null ptrs)
              between @index and the bottom of the array.
              Assuming the holes are distributed uniformly, if 2 or more
              holes are expected, we do a minimum shift.
            - If @shiftflag == L_MIN_DOWNSHIFT, the downward shifting
              cascade of items progresses a minimum amount, until
              the first empty slot is reached.  This mode requires
              some computation before the actual shifting is done.
            - If @shiftflag == L_FULL_DOWNSHIFT, a shifting cascade is
              performed where pa[i] --> pa[i + 1] for all i >= index.
              Then, the item is inserted at pa[index].
      (3) If you are not using L_AUTO_DOWNSHIFT, the rule of thumb is
          to use L_FULL_DOWNSHIFT if the array is compacted (each
          element points to an item), and to use L_MIN_DOWNSHIFT
          if there are a significant number of null pointers.
          There is no penalty to using L_MIN_DOWNSHIFT for a
          compacted array, however, because the full shift is required
          and we don't do the O(n) computation to look for holes.
      (4) This should not be used repeatedly on large arrays,

lib/Image/Leptonica/Func/scale.pm  view on Meta::CPAN


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

  pixScaleGrayRankCascade()

      Input:  pixs (8 bpp, not cmapped)
              level1, ... level4 (rank thresholds, in set {0, 1, 2, 3, 4})
      Return: pixd (8 bpp, downscaled by up to 16x)

  Notes:
      (1) This performs up to four cascaded 2x rank reductions.
      (2) Use level = 0 to truncate the cascade.

=head2 pixScaleGrayToBinaryFast

PIX * pixScaleGrayToBinaryFast ( PIX *pixs, l_int32 factor, l_int32 thresh )

  pixScaleGrayToBinaryFast()

      Input:  pixs (8 bpp grayscale)
              factor (integer reduction factor >= 1)
              thresh (binarization threshold)



( run in 0.544 second using v1.01-cache-2.11-cpan-49f99fa48dc )