Computer Vision is a wide topic but after showing some interesting projects I think we should start going to the root… the code, We use Python for coding our Computer Vision projects and there are numerous Open CV packages already created for coding Computer Vision projects, we will use Open CV which is an Open Source Computer Vision library.
So today I’m going to show you the first steps on Computer Vision coding…
When we start coding the first step is to load the libraries that we will need in our code, we load cv2 library.
Today we are showing how to load and show an image :
import cv2
input = cv2.imread(‘./pathtofile/myfile.jpg’)
cv2.imshow(‘descriptive text’,input)
cv2.waitKey()
cv2.destroyAllWindows()
As you can see after loading cv2 library on line 1 (cv2 is the module import name for opencv-python), we create a variable “input” where we load our image (line 2), after that on line 3 we show the image loaded on our variable “input” and we include some descriptive text.
On line 4 we wait for a key to be pressed by the user so the user has all the time for looking at the picture until a key is pressed, when the key is pressed we need to liberate resources on line 5 by destroying the picture’s window.
That’s it… plane and simple…
This how we start with the coding for our Computer Vision projects…
You are welcome to leave comments…