Professional Documents
Culture Documents
A1 Drawing Line
A1 Drawing Line
1. Importing Packages.
In [1]: import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
cv2
13
Out[2]:
Note꞉ After the excecution of the previous cell following steps has to be performed before the execution of next cell.
1. Left click on the opencv2 image window.
2. Press "enter" key.
In [3]: cv2.destroyAllWindows()
In [4]: plt.imshow(img)
plt.xlabel('x')
plt.ylabel('y')
Text(0,
0.5,
'y')
Out[4]:
array([[
1,
1,
1,
...,
1,
255,
255],
Out[5]:
[
1,
1,
1,
...,
255,
255,
255],
[
1,
1,
1,
...,
255,
255,
255],
...,
[
1,
255,
255,
...,
1,
1,
1],
[255,
255,
255,
...,
1,
1,
1],
[255,
255,
255,
...,
1,
1,
1]],
dtype=uint8)
In [6]: cv2.imshow('Image
With
Line',line_img)
cv2.waitKey(0)
13
Out[6]:
Note꞉ After the excecution of the previous cell following steps has to be performed before the execution of next cell.
1. Left click on the opencv2 image window.
2. Press "enter" key.
In [7]: cv2.destroyAllWindows()
In [8]: plt.imshow(img)
plt.xlabel('x')
plt.ylabel('y')
Text(0,
0.5,
'y')
Out[8]:
In [ ]: