Image-Leptonica

 view release on metacpan or  search on metacpan

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

          and pixUpDownDetectGeneral() for details.
      (2) The returned confidence is the normalized difference
          between the number of detected up and down ascenders,
          assuming that the text is either rightside-up or upside-down
          and not rotated at a 90 degree angle.

=head2 pixUpDownDetectDwa

l_int32 pixUpDownDetectDwa ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 debug )

  pixUpDownDetectDwa()

      Input:  pixs (1 bpp, deskewed, English text, 150 - 300 ppi)
              &conf (<return> confidence that text is rightside-up)
              mincount (min number of up + down; use 0 for default)
              debug (1 for debug output; 0 otherwise)
      Return: 0 if OK, 1 on error

  Notes:
      (1) Faster (DWA) version of pixUpDownDetect().
      (2) This is a special case (but typical and slightly faster) of
          pixUpDownDetectGeneralDwa(), where the pixels identified
          through the HMT (hit-miss transform) are not clipped by
          a truncated word mask pixm.  See pixUpDownDetectGeneral()
          for usage and other details.
      (3) The returned confidence is the normalized difference
          between the number of detected up and down ascenders,
          assuming that the text is either rightside-up or upside-down
          and not rotated at a 90 degree angle.

=head2 pixUpDownDetectGeneral

l_int32 pixUpDownDetectGeneral ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 npixels, l_int32 debug )

  pixUpDownDetectGeneral()

      Input:  pixs (1 bpp, deskewed, English text, 150 - 300 ppi)
              &conf (<return> confidence that text is rightside-up)
              mincount (min number of up + down; use 0 for default)
              npixels (number of pixels removed from each side of word box)
              debug (1 for debug output; 0 otherwise)
      Return: 0 if OK, 1 on error

  Notes:
      (1) See pixOrientDetect() for other details.
      (2) @conf is the normalized difference between the number of
          detected up and down ascenders, assuming that the text
          is either rightside-up or upside-down and not rotated
          at a 90 degree angle.
      (3) The typical mode of operation is @npixels == 0.
          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

l_int32 pixUpDownDetectGeneralDwa ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 npixels, l_int32 debug )

  pixUpDownDetectGeneralDwa()

      Input:  pixs (1 bpp, deskewed, English text)
              &conf (<return> confidence that text is rightside-up)
              mincount (min number of up + down; use 0 for default)
              npixels (number of pixels removed from each side of word box)
              debug (1 for debug output; 0 otherwise)
      Return: 0 if OK, 1 on error

  Notes:
      (1) See the notes in pixUpDownDetectGeneral() for usage.

=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
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.648 second using v1.01-cache-2.11-cpan-524268b4103 )