January 2018
Intermediate to advanced
268 pages
6h 20m
English
Let's understand the previous piece of code, line by line. In the first line, we are importing the OpenCV library. We need this for all the functions we will be using in the code. In the second line, we are reading the image and storing it in a variable. OpenCV uses NumPy data structures to store the images. You can learn more about NumPy at http://www.numpy.org.
So if you open up the Python shell and type the following, you will see the datatype printed on the terminal:
> import cv2> img = cv2.imread('./images/input.jpg')> type(img)<type 'numpy.ndarray'>
In the next line, we display the image in a new window. The first argument in cv2.imshow is the name of the window. The second argument is the image you want to display. ...
Read now
Unlock full access