Una imagen digital es simplemente un arreglo de datos (similar a una matriz), donde cada elemento corresponde a la informacion de cada pixel.
| 0 | 1 | 2 | 3 | 4 | |
|---|---|---|---|---|---|
| 0 | 10 | 15 | 6 | 7 | 8 |
| 1 | 1 | 4 | 12 | 6 | 10 |
| 2 | 0 | 11 | 25 | 20 | 10 |
| 3 | 9 | 7 | 4 | 21 | 7 |
| 4 | 5 | 10 | 5 | 0 | 12 |
In [1]:
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
imagen=plt.imread("img/caracol.jpg")
In [3]:
imagen
Out[3]:
In [4]:
plt.imshow(imagen)
Out[4]:
In [5]:
plt.figure(figsize=(10,10))
plt.imshow(imagen)
Out[5]:
In [6]:
plt.figure(figsize=(10,10))
plt.imshow(255-imagen)
Out[6]:
In [18]:
plt.figure(figsize=(10,10))
plt.imshow(imagen[:,:,0],cmap="Greys")
Out[18]:
In [20]:
plt.figure(figsize=(10,10))
plt.imshow(255-imagen[:,:,0],cmap="Greys")
Out[20]:
In [9]:
imagen.shape
Out[9]:
In [10]:
imagen.size
Out[10]:
In [11]:
imagen.min()
Out[11]:
In [12]:
imagen.max()
Out[12]:
In [13]:
imagen**2
Out[13]:
In [14]:
plt.figure(figsize=(10,10))
plt.imshow(imagen**2)
Out[14]:
In [ ]:
plt.imshow?