Professional Documents
Culture Documents
Activité 2
Activité 2
Entrée [ ]:
Entrée [ ]:
Entrée [ ]:
Out[3]:
<matplotlib.image.AxesImage at 0x7f53ae1eee50>
Entrée [ ]:
Out[4]:
<matplotlib.image.AxesImage at 0x7f53ad16ec50>
Forme de l'image
Entrée [ ]:
Out[5]:
Entrée [ ]:
Entrée [ ]:
histogramme
Entrée [ ]:
1 n , m , p = img_cat.shape
2 img_cat_r= img_cat[:,:,0].ravel()
3 img_cat_g= img_cat[:,:,1].ravel()
4 img_cat_b= img_cat[:,:,2].ravel()
5 plt.rcParams["figure.figsize"] = (18, 6)
6 plt.subplot(131)
7 plt.title("historgramme composante rouge")
8 plt.hist(img_cat_r,bins=256,color="r")
9 plt.subplot(132)
10 plt.title("historgramme composante vert")
11 plt.hist(img_cat_g,bins=256,color="g")
12 plt.subplot(133)
13 plt.title("historgramme composante blue")
14 plt.hist(img_cat_b,bins=256,color="b")
15 plt.show()
inversement de couleur
Entrée [ ]:
1 img_cam = data.camera()
2 array_inver=255-img_cam
3
4 plt.subplot(121)
5 plt.title("Avant inversement")
6 plt.imshow(img_cam, cmap='gray')
7
8 plt.subplot(122)
9 plt.title("Apres inversement")
10 plt.imshow(array_inver, cmap='gray')
11
12 plt.show()
Bruit et restaurastion
Entrée [ ]:
Restauration de l'image
Entrée [ ]:
Détection de contour
Entrée [ ]:
Seuillage
Entrée [ ]:
1 import numpy as np
2 seuil = filters.threshold_minimum(img_cam)
3 binary_image = np.where(img_cam > seuil , np.ones_like(img_cam) ,np.zeros_like(img_cam) )
4 plt.imshow(binary_image , cmap="gray")
Out[36]:
<matplotlib.image.AxesImage at 0x7f53929cca10>
Filtres
Entrée [ ]:
Out[16]:
<matplotlib.image.AxesImage at 0x7f539b571810>
Entrée [15]:
1 import skimage
2 help(skimage)
NAME
skimage - Image Processing for Python
DESCRIPTION
``scikit-image`` (a.k.a. ``skimage``) is a collection of algorithms for image
processing and computer vision.
The main package of ``skimage`` only provides a few utilities for converting
between image data types; for most features, you need to import one of the
following subpackages:
Subpackages
-----------
color
Color space conversion.
data
Test images and example data.
d
Entrée [ ]: