Parcourir la source

Merge branch 'release/v0.0.6'

Jerome Buisine il y a 5 ans
Parent
commit
c659b519d0
3 fichiers modifiés avec 46 ajouts et 6 suppressions
  1. 6 3
      README.rst
  2. 38 1
      ipfml/image_processing.py
  3. 2 2
      setup.py

+ 6 - 3
README.rst

@@ -9,9 +9,9 @@ How to use ?
 To use, simply do::
 
     >>> from PIL import Image
-    >>> import ipfml as iml
+    >>> from ipfml import image_processing
     >>> img = Image.open('path/to/image.png')
-    >>> s = iml.metrics.get_SVD_s(img)
+    >>> s = image_processing.get_LAB_L_SVD_s(img)
 
 
 Modules
@@ -22,11 +22,14 @@ This project contains modules.
 - **img_processing** : *PIL image processing part*
     - fig2data(fig): *Convert a Matplotlib figure to a 3D numpy array with RGB channels and return it*
     - fig2img(fig): *Convert a Matplotlib figure to a PIL Image in RGB format and return it*
+    - 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*
 
 - **metrics** : *Metrics computation of PIL image*
     - get_SVD(image): *Transforms PIL Image into SVD*
-    - get_SVD_s(image): *Transforms PIL Image into SVD and returns only 's' part*
     - get_SVD_U(image): *Transforms PIL Image into SVD and returns only 'U' part*
+    - get_SVD_s(image): *Transforms PIL Image into SVD and returns only 's' part*
     - get_SVD_V(image): *Transforms PIL Image into SVD and returns only 'V' part*
 
     - get_LAB(image): *Transforms PIL Image into LAB*

+ 38 - 1
ipfml/image_processing.py

@@ -1,6 +1,7 @@
 from PIL import Image
 
 import numpy as np
+import ipfml.metrics as metrics
 
 def fig2data(fig):
     """
@@ -29,4 +30,40 @@ def fig2img(fig):
     # put the figure pixmap into a numpy array
     buf = fig2data(fig)
     w, h, d = buf.shape
-    return Image.frombytes("RGB", (w, h), buf.tostring())
+    return Image.frombytes("RGB", (w, h), buf.tostring())
+
+def get_LAB_L_SVD(image):
+    """
+    @brief Returns Singular values from LAB L Image information
+    @param fig a matplotlib figure
+    @return a Python Imaging Library (PIL) image : default size (480,640,3)
+    """
+    L = metrics.get_LAB_L(image)
+    return metrics.get_SVD(L)
+
+def get_LAB_L_SVD_s(image):
+    """
+    @brief Returns s (Singular values) SVD from L of LAB Image information
+    @param PIL Image
+    @return vector of singular values
+    """
+    L = metrics.get_LAB_L(image)
+    return metrics.get_SVD_s(L)
+
+def get_LAB_L_SVD_U(image):
+    """
+    @brief Returns U SVD from L of LAB Image information
+    @param PIL Image
+    @return vector of singular values
+    """
+    L = metrics.get_LAB_L(image)
+    return metrics.get_SVD_U(L)
+
+def get_LAB_L_SVD_V(image):
+    """
+    @brief Returns V SVD from L of LAB Image information
+    @param PIL Image
+    @return vector of singular values
+    """
+    L = metrics.get_LAB_L(image)
+    return metrics.get_SVD_V(L)

+ 2 - 2
setup.py

@@ -5,7 +5,7 @@ def readme():
         return f.read()
 
 setup(name='IPFML',
-      version='0.0.5',
+      version='0.0.6',
       description='Image Processing For Machine Learning',
       long_description=readme(),
       classifiers=[
@@ -24,7 +24,7 @@ setup(name='IPFML',
           'numpy',
           'Pillow',
           'sklearn',
-          'skimage',
+          'scikit-image',
           'scipy'
       ],
       zip_safe=False)