From 81ea5c35cba7f004881ae4fae1eafc135d6d094f Mon Sep 17 00:00:00 2001 From: Stephen Johnson Date: Sun, 13 Oct 2013 21:57:07 -0700 Subject: [PATCH] Fully document PIL.ImageStat --- PIL/ImageStat.py | 17 ------------ docs/PIL.rst | 8 ------ docs/reference/ImageStat.rst | 53 ++++++++++++++++++++++++++++++++++++ docs/reference/index.rst | 1 + 4 files changed, 54 insertions(+), 25 deletions(-) create mode 100644 docs/reference/ImageStat.rst diff --git a/PIL/ImageStat.py b/PIL/ImageStat.py index 508d6b46e..ef63b7857 100644 --- a/PIL/ImageStat.py +++ b/PIL/ImageStat.py @@ -25,25 +25,8 @@ from PIL import Image import operator, math from functools import reduce -## -# The ImageStat module calculates global statistics for an -# image, or a region of an image. -## - -## -# Calculate statistics for the given image. If a mask is included, -# only the regions covered by that mask are included in the -# statistics. class Stat: - "Get image or feature statistics" - - ## - # Create a statistics object. - # - # @def __init__(image, mask=None) - # @param image A PIL image, or a precalculate histogram. - # @param mask An optional mask. def __init__(self, image_or_list, mask = None): try: diff --git a/docs/PIL.rst b/docs/PIL.rst index 10774bcc7..f5ebb69a4 100644 --- a/docs/PIL.rst +++ b/docs/PIL.rst @@ -94,14 +94,6 @@ can be found here. :undoc-members: :show-inheritance: -:mod:`ImageStat` Module ------------------------ - -.. automodule:: PIL.ImageStat - :members: - :undoc-members: - :show-inheritance: - :mod:`ImageTk` Module --------------------- diff --git a/docs/reference/ImageStat.rst b/docs/reference/ImageStat.rst new file mode 100644 index 000000000..c8dfe3062 --- /dev/null +++ b/docs/reference/ImageStat.rst @@ -0,0 +1,53 @@ +.. py:module:: PIL.ImageStat +.. py:currentmodule:: PIL.ImageStat + +:py:mod:`ImageStat` Module +========================== + +The :py:mod:`ImageStat` module calculates global statistics for an image, or +for a region of an image. + +.. py:class:: PIL.ImageStat.Stat(image_or_list, mask=None) + + Calculate statistics for the given image. If a mask is included, + only the regions covered by that mask are included in the + statistics. You can also pass in a previously calculated histogram. + + :param image: A PIL image, or a precalculated histogram. + :param mask: An optional mask. + + .. py:attribute:: extrema + + Min/max values for each band in the image. + + .. py:attribute:: count + + Total number of pixels. + + .. py:attribute:: sum + + Sum of all pixels. + + .. py:attribute:: sum2 + + Squared sum of all pixels. + + .. py:attribute:: pixel + + Average pixel level. + + .. py:attribute:: median + + Median pixel level. + + .. py:attribute:: rms + + RMS (root-mean-square). + + .. py:attribute:: var + + Variance. + + .. py:attribute:: stddev + + Standard deviation. diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 929ac099e..fa0522b99 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -19,4 +19,5 @@ Reference ImagePath ImageQt ImageSequence + ImageStat ../PIL