%matplotlib inline
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
In [5]:
from skimage import data
photo_data = misc.imread('./wifire/sd-3layers.jpg')

type(photo_data)
/home/hyeok/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:2: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use ``imageio.imread`` instead.
  
Out[5]:
numpy.ndarray
In [6]:
plt.figure(figsize = (15,15))
plt.imshow(photo_data)
Out[6]:
<matplotlib.image.AxesImage at 0x7f1642fecdd8>
In [7]:
photo_data.shape
Out[7]:
(3725, 4797, 3)
In [8]:
photo_data.size
Out[8]:
53606475
In [9]:
photo_data.min(), photo_data.max()
Out[9]:
(0, 255)
In [10]:
photo_data.mean()
Out[10]:
75.8299354508947
In [11]:
photo_data[150, 250]
Out[11]:
array([ 17,  35, 255], dtype=uint8)
In [12]:
photo_data[150, 250, 1]
Out[12]:
35
In [14]:
photo_data[150, 250] = 0
plt.figure(figsize=(10,10))
plt.imshow(photo_data)
Out[14]:
<matplotlib.image.AxesImage at 0x7f1640fdff28>
In [15]:
photo_data[200 : 800 , : , 1] = 255
plt.figure(figsize=(10, 10))
plt.imshow(photo_data)
Out[15]:
<matplotlib.image.AxesImage at 0x7f1640daa6d8>
In [16]:
photo_data[200 : 800 , : ] = 255
plt.figure(figsize=(10, 10))
plt.imshow(photo_data)
Out[16]:
<matplotlib.image.AxesImage at 0x7f1640f77f28>
In [17]:
photo_data[200 : 800 , : ] = 0
plt.figure(figsize=(10, 10))
plt.imshow(photo_data)
Out[17]:
<matplotlib.image.AxesImage at 0x7f1640f456d8>


'Python Library > Numpy' 카테고리의 다른 글

Day 4. Image Processing with a numpy -02  (0) 2019.06.12
Day 4. Numpy02  (0) 2019.06.12
Day 3. Numpy01  (0) 2019.06.11

+ Recent posts