In [1]:
import cv2
import numpy as np

img = cv2.imread("data/soccerball.jpeg")
print(type(img), img.shape)


<class 'numpy.ndarray'> (287, 300, 3)

In [2]:
blue = img[100, 100, 0]

In [3]:
print(blue)


222

In [4]:
img.item(10, 10, 2)


Out[4]:
0

In [5]:
img.itemset((10,10,2), 100)

In [6]:
img.item(10,10,2)


Out[6]:
100

In [7]:
img.dtype


Out[7]:
dtype('uint8')

In [8]:
b,g,r = cv2.split(img)

In [10]:
img2 = cv2.merge((b,g,r))

In [14]:
from matplotlib import pyplot as plt
%matplotlib inline

In [18]:
plt.imshow(img2)


Out[18]:
<matplotlib.image.AxesImage at 0xbff3c08550>

In [ ]: