Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente Prochaine révisionLes deux révisions suivantes | ||
teaching:progappchim:analyse_images [2014/02/11 06:44] – créée villersd | teaching:progappchim:analyse_images [2016/02/17 14:00] – [OpenCV] villersd | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Analyse d' | ====== Analyse d' | ||
- | En préparation. Utilisation des librairies | + | Le traitement d' |
+ | |||
+ | ===== Utilisation | ||
+ | <note tip>La librairie Pillow devrait prendre la succession, avec des appels très semblables.</ | ||
+ | |||
+ | Voici un exemple de lecture d'une image, de conversion en monochrome et ensuite en tableau de données numériques de NumPy. Une transformée de Fourier bidimensionnel est effectuée, ainsi que quelques autres traitements, | ||
+ | |||
+ | <sxh python; title : FFT-structures_2D_01.py> | ||
+ | #! / | ||
+ | # -*- coding: utf-8 -*- | ||
+ | """ | ||
+ | Digital Image processing with PIL | ||
+ | |||
+ | """ | ||
+ | # sources & refs : http:// | ||
+ | # http:// | ||
+ | # http:// | ||
+ | # http:// | ||
+ | |||
+ | import PIL | ||
+ | import Image | ||
+ | import numpy as np | ||
+ | import matplotlib.pyplot as plt | ||
+ | |||
+ | dirfile="" | ||
+ | # | ||
+ | filename=" | ||
+ | im = Image.open(str(dirfile+filename)) | ||
+ | im = im.convert(' | ||
+ | im.show() | ||
+ | data = np.asarray(im) # a is readonly | ||
+ | print type(data), data.ndim, data.shape, data.dtype | ||
+ | datafft = abs(np.fft.rfft2(data)) | ||
+ | datafft[0, 0] = 0 # remove DC component for visualization | ||
+ | print type(datafft), | ||
+ | plt.imshow(np.abs(np.fft.fftshift(datafft)), | ||
+ | plt.show() | ||
+ | plt.imshow(np.abs(np.fft.fftshift(datafft))[192: | ||
+ | plt.show() | ||
+ | im2 = Image.fromarray(datafft) | ||
+ | im2.show() | ||
+ | im2.save(' | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | <note tip>Pour approfondir l' | ||
+ | |||
+ | ==== Références ==== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ===== Scikit-image ===== | ||
+ | * Voir la galerie d' | ||
+ | |||
+ | ===== OpenCV ===== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | Références diverses : | ||
+ | * [[http:// | ||
+ | |||
+ | ===== pymaging ===== | ||
+ | * [[https:// | ||