Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an image.entropy() method (second revision) #3608

Merged
merged 3 commits into from Jun 29, 2019

Commits on Jun 26, 2019

  1. Added an image.entropy() method

    This calculates the entropy for the image, based on the histogram.
    
    Because this uses image histogram data directly, the existing C
    function underpinning the `image.histogram()` method was abstracted
    into a static function to parse extrema tuple arguments, and a new
    C function was added to calculate image entropy, making use of the
    new static extrema function.
    
    The extrema-parsing function was written by @homm, based on the
    macro abstraction I wrote, during the discussion of my first
    entropy-method pull request: https://git.io/fhodS
    
    The new `image.entropy()` method is based on `image.histogram()`,
    and will accept the same arguments to calculate the histogram data
    it will use to assess the entropy of the image.
    
    The algorithm and methodology is based on existing Python code:
    
    * https://git.io/fhmIU
    
    ... A test case in the `Tests/` directory, and doctest lines in
    `selftest.py`, have both been added and checked.
    
    Changes proposed in this pull request:
    
    * Added “math.h” include to _imaging.c
    * The addition of an `image.entropy()` method to the `Image`
      Python class,
    * The abstraction of the extrema-parsing logic of of the C
      function `_histogram` into a static function, and
    * The use of that static function in both the `_histogram` and
      `_entropy` C functions.
    * Minor documentation addenda in the docstrings for both the
      `image.entropy()` and `image.histogram()` methods were also
      added.
    * Removed outdated boilerplate from testing code
    * Removed unused “unittest” import
    fish2000 authored and radarhere committed Jun 26, 2019
    Copy the full SHA
    7b815a5 View commit details
    Browse the repository at this point in the history
  2. Removed variable

    radarhere committed Jun 26, 2019
    Copy the full SHA
    1a71faf View commit details
    Browse the repository at this point in the history
  3. Lint fixes

    radarhere committed Jun 26, 2019
    Copy the full SHA
    8b447c4 View commit details
    Browse the repository at this point in the history