Parcourir la source

Update of documentation

Jérôme BUISINE il y a 5 ans
Parent
commit
ba454ef00e
11 fichiers modifiés avec 84 ajouts et 63 suppressions
  1. 9 29
      README.md
  2. 3 3
      README.rst
  3. 4 0
      build.sh
  4. 0 0
      docs/.nojekyll
  5. 13 0
      docs/index.html
  6. 0 7
      example.py
  7. 7 7
      ipfml/filters/noise.py
  8. 8 0
      ipfml/metrics.py
  9. 19 16
      ipfml/processing.py
  10. 10 0
      requirements.txt
  11. 11 1
      setup.py

+ 9 - 29
README.md

@@ -21,40 +21,20 @@ Modules
 This project contains modules.
 
 - **processing** : *Image processing module*
-    - get_LAB_L_SVD_U(image): *Returns U SVD from L of LAB Image information*
-    - get_LAB_L_SVD_s(image): *Returns s (Singular values) SVD from L of LAB Image information*
-    - get_LAB_L_SVD_V(image): *Returns V SVD from L of LAB Image information*
-    - divide_in_blocks(image, block_size): *Divide image into equal size blocks*
-    - rgb_to_mscn(image): *Convert RGB Image into Mean Subtracted Contrast Normalized (MSCN) using only gray level*
-    - rgb_to_grey_low_bits(image, nb_bits=4): *Convert RGB Image into grey image using only 4 low bits values by default*
-    - rgb_to_LAB_L_low_bits(image, nb_bits=4): *Convert RGB Image into LAB L chanel image using only 4 low bits values by default*
-    - rgb_to_LAB_L_bits(image, interval): *Convert RGB Image into LAB L chanel image using specific interval of bits to keep (2, 5) such as example*
-    - normalize_arr(arr): *Normalize array values*
-    - normalize_arr_with_range(arr, min, max): *Normalize array values with specific min and max values*
-    - normalize_2D_arr(arr): *Return 2D array normalize from its min and max values*
-
 - **metrics** : *Metrics computation of PIL or 2D numpy image*
-    - get_SVD(image): *Transforms Image into SVD*
-    - get_SVD_U(image): *Transforms Image into SVD and returns only 'U' part*
-    - get_SVD_s(image): *Transforms Image into SVD and returns only 's' part*
-    - get_SVD_V(image): *Transforms Image into SVD and returns only 'V' part*
-    - get_LAB(image): *Transforms Image into LAB*
-    - get_LAB_L(image): *Transforms Image into LAB and returns only 'L' part*
-    - get_LAB_A(image): *Transforms Image into LAB and returns only 'A' part*
-    - get_LAB_B(image): *Transforms Image into LAB and returns only 'B' part*
-    - get_XYZ(image): *Transforms Image into XYZ*
-    - get_XYZ_X(image): *Transforms Image into XYZ and returns only 'X' part*
-    - get_XYZ_Y(image): *Transforms Image into XYZ and returns only 'Y' part*
-    - get_XYZ_Z(image): *Transforms Image into XYZ and returns only 'Z' part*
-    - get_low_bits_img(image, nb_bits=4): *Returns Image or Numpy array with data information reduced using only low bits*
-
 - **filters** : *Image filter module*
-    - **noise** : *Noise filters implemented*
-        - white_noise(image, n, distribution_interval=(-0.5, 0.5)) : *Add white noise to image using the **n** variable which manages intensity of noise in interval [1, 999] and the **distribution_interval** variable which manages interval of uniform distribution*
 
-All these modules will be enhanced during development of the project
+All these modules will be enhanced during development of the package. Documentation is available [here](https://jbuisine.github.io/IPFML/).
 
 How to contribute
 -----------------
 
 This git project uses [git-flow](https://danielkummer.github.io/git-flow-cheatsheet/) implementation. You are free to contribute to it.
+
+## Contributors
+
+* [jbuisine](https://github.com/jbuisine)
+
+## Licence
+
+[MIT](https://github.com/jbuisine/IPFML/blob/master/LICENSE)

+ 3 - 3
README.rst

@@ -1,7 +1,7 @@
 IPFML
 =====
 
-Image Processing For Machine Learning package.
+Image Processing For Machine Learning python package.
 
 This is a package developed during a thesis project.
 
@@ -30,6 +30,6 @@ All these modules will be enhanced during development of the package.
 Documentation
 -------------
 
-For more information about package, documentation_ is available  
+For more information about package, documentation_ is available. 
 
-.. _documentation: https://gogs.univ-littoral.fr/jerome.buisine/IPFML
+.. _documentation: https://jbuisine.github.io/IPFML/  

+ 4 - 0
build.sh

@@ -0,0 +1,4 @@
+#! bin/bash
+
+# script used to build documentation from setup.py build command
+cd docs && make html

.nojekyll → docs/.nojekyll


+ 13 - 0
docs/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>IPFML documentation</title>
+    <meta http-equiv="refresh" content="0; url=./_build/html/index.html" />
+</head>
+<body>
+
+</body>
+</html> 
+
+
+

+ 0 - 7
example.py

@@ -1,7 +0,0 @@
-from PIL import Image
-from ipfml import image_processing
-
-path = './images/test_img.png'
-img = Image.open(path)
-blocks = image_processing.divide_in_blocks(img, (10, 10))
-print(len(blocks))

+ 7 - 7
ipfml/filters/noise.py

@@ -23,7 +23,7 @@ def _global_noise_filter(image,
     Returns:
         2D Numpy array with specified noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import _global_noise_filter as gf
     >>> import numpy as np
@@ -109,7 +109,7 @@ def white_noise(image,
     Returns:
         2D Numpy array with white noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import white_noise
     >>> import numpy as np
@@ -145,7 +145,7 @@ def gaussian_noise(image,
     Returns:
         2D Numpy array with gaussian noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import gaussian_noise
     >>> import numpy as np
@@ -181,7 +181,7 @@ def laplace_noise(image,
     Returns:
         2D Numpay array with Laplace noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import laplace_noise
     >>> import numpy as np
@@ -217,7 +217,7 @@ def cauchy_noise(image,
     Returns:
         2D Numpy array with Cauchy noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import cauchy_noise
     >>> import numpy as np
@@ -253,7 +253,7 @@ def log_normal_noise(image,
     Returns:
         2D Numpy array with Log-normal noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import log_normal_noise
     >>> import numpy as np
@@ -289,7 +289,7 @@ def mut_white_noise(image,
     Returns:
         2D Numpy array with multiplied white noise applied
 
-    Usage:
+    Example:
 
     >>> from ipfml.filters.noise import mut_white_noise
     >>> import numpy as np

+ 8 - 0
ipfml/metrics.py

@@ -268,6 +268,9 @@ def get_XYZ_Z(image):
     Returns:
         The Z chanel from XYZ information
 
+    Raises:
+        ValueError: If `nb_bits` has unexpected value. `nb_bits` needs to be in interval [1, 8].
+
     Usage:
 
     >>> from PIL import Image
@@ -329,6 +332,11 @@ def get_bits_img(image, interval):
     Returns:
         Numpy array with reduced values
 
+    Raises:
+        ValueError: If min value from interval is not >= 1.
+        ValueError: If max value from interval is not <= 8.
+        ValueError: If min value from interval >= max value.
+
     Usage:
 
     >>> from PIL import Image

+ 19 - 16
ipfml/processing.py

@@ -19,7 +19,7 @@ def get_LAB_L_SVD(image):
     Returns:
         U, s, V information obtained from SVD compression using Lab
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -45,7 +45,7 @@ def get_LAB_L_SVD_s(image):
     Returns:
         vector of singular values
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -67,7 +67,7 @@ def get_LAB_L_SVD_U(image):
     Returns:
         U matrix of SVD compression
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -89,7 +89,7 @@ def get_LAB_L_SVD_V(image):
     Returns:
         V matrix of SVD compression
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -114,9 +114,12 @@ def divide_in_blocks(image, block_size, pil=True):
     Returns:
         list containing all 2D Numpy blocks (in RGB or not)
 
-    Usage:
+    Raises:
+        ValueError: If `image_width` or `image_heigt` are not compatible to produce correct block sizes
 
-    >>> import Numpy as np
+    Example:
+
+    >>> import numpy as np
     >>> from PIL import Image
     >>> from ipfml import processing
     >>> from ipfml import metrics
@@ -154,10 +157,10 @@ def divide_in_blocks(image, block_size, pil=True):
     width, height = block_size
 
     if (image_width % width != 0):
-        raise "Width size issue, block size not compatible"
+        raise ValueError("Width size issue, block size not compatible")
 
     if (image_height % height != 0):
-        raise "Height size issue, block size not compatible"
+        raise ValueError("Height size issue, block size not compatible")
 
     nb_block_width = image_width / width
     nb_block_height = image_height / height
@@ -192,10 +195,10 @@ def normalize_arr(arr):
     Returns:
         Normalized 1D array
 
-    Usage:
+    Example:
 
     >>> from ipfml import processing
-    >>> import Numpy as np
+    >>> import numpy as np
     >>> arr = np.arange(11)
     >>> arr_normalized = processing.normalize_arr(arr)
     >>> arr_normalized[1]
@@ -221,10 +224,10 @@ def normalize_arr_with_range(arr, min, max):
     Returns:
         Normalized 1D Numpy array
 
-    Usage:
+    Example:
 
     >>> from ipfml import processing
-    >>> import Numpy as np
+    >>> import numpy as np
     >>> arr = np.arange(11)
     >>> arr_normalized = processing.normalize_arr_with_range(arr, 0, 20)
     >>> arr_normalized[1]
@@ -248,7 +251,7 @@ def normalize_2D_arr(arr):
     Returns:
         Normalized 2D Numpy array
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -284,7 +287,7 @@ def rgb_to_mscn(image):
     Returns:
         2D Numpy array with MSCN information
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -313,7 +316,7 @@ def rgb_to_grey_low_bits(image, nb_bits=4):
     Returns:
         2D Numpy array with low bits information kept
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing
@@ -339,7 +342,7 @@ def rgb_to_LAB_L_low_bits(image, nb_bits=4):
     Returns:
         2D Numpy array with low bits information kept
 
-    Usage:
+    Example:
 
     >>> from PIL import Image
     >>> from ipfml import processing

+ 10 - 0
requirements.txt

@@ -0,0 +1,10 @@
+sphinx
+matplotlib
+numpy
+Pillow
+sklearn
+scikit-image
+scipy
+opencv-python
+scipy
+yapf

+ 11 - 1
setup.py

@@ -16,6 +16,7 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
         from ipfml import metrics
         from ipfml.filters import noise as noise_filters
 
+        print("==============================")
         print("Run test command...")
         doctest.testmod(processing)
         doctest.testmod(metrics)
@@ -23,17 +24,26 @@ class BuildTestCommand(setuptools.command.build_py.build_py):
 
         # Run format code using ypaf
         try:
+            print("==============================")
             print("Run format code command...")
             self.spawn(['yapf', '-ir', '-vv', 'ipfml'])
         except RuntimeError:
             self.warn('format pakcage code failed')
 
+        # Run update auto generated documentation
+        try:
+            print("==============================")
+            print("Run update of auto generated documentation...")
+            self.spawn(['bash', './build.sh'])
+        except RuntimeError:
+            self.warn('Error during documentation rendering')
+
         setuptools.command.build_py.build_py.run(self)
 
 
 setup(
     name='ipfml',
-    version='0.1.6',
+    version='0.1.7',
     description='Image Processing For Machine Learning',
     long_description=readme(),
     classifiers=[