This tutorial is the foundation of computer vision delivered as “Lesson 2” of the series, there are more Lessons upcoming which would talk to the extend of building your own deep learning based computer vision projects.
Note from author :
_This tutorial is the foundation of computer vision delivered as “Lesson 2” of the series, there are more Lessons upcoming which would talk to the extend of building your own deep learning based computer vision projects. You can find the [complete syllabus and table of content here_](https://medium.com/@Rakesh.thoppaen/free-computer-vision-full-syllabus-65059d21ea2a?source=friends_link&sk=519548ce05dc078146506fe30dd0edbc)
Target Audience_ : Final year College Students, New to Data Science Career, IT employees who wants to switch to data science Career ._
Takeaway_ : Main takeaway from this article :_
Before we perform any operations or manipulations of an image, it is important for us to load an image of our choice to the disk. We will perform this activity using OpenCV. There are two ways we can perform this loading operations. One way is to load the image by simply passing the image path and image file to the OpenCV’s “imread” function. The other way is to pass the image through a command line argument using python module argparse.
Fig 2.1 Loading an Image from Disk by hard coding the image path and name in code
#Loading Image from disk
image = cv2.imread(“C:/Sample_program/example.jpg”)
Let’s create a file name Loading_image_from_disk.py in a notepad++. First we import our OpenCV library and contains our image processing functions. we import the library using the first line of code as cv2. The second line of code is where we read our image using cv2.imread function in OpenCV and we pass on the path of image as parameter, the path should also contain the file name with its image format extension .jpg , .jpeg , .png or .tiff .
*syntax *— // image=cv2.imread(“path/to/your/image.jpg”) //
Absolute care has to be taken while specifying the file extension name. we are likely to receive the below error if we provide the wrong extension name
Traceback (most recent call last):
File “Loading_image_from_disk.py”, line 4, in
cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow’
The third line of code is where we actually display our image loaded. First parameter is a string, or the “name” of our window. The second parameter is the object to which image was loaded.
Finally, a call to cv2.waitKey pauses the execution of the script until we press a key on our keyboard. Using a parameter of “0” indicates that any keypress will un-pause the execution. Please feel free to run you program without having the last line of code in your program to see the difference.
Enroll now at CETPA, the best Institute in India for Artificial Intelligence Online Training Course and Certification for students & working professionals & avail 50% instant discount.
OpenCV Python Tutorial: Computer Vision With OpenCV In Python: Learn Vision Includes all OpenCV Image Processing Features with Simple Examples. Face Detection, Face Recognition. Computer Vision is an AI based, that is, Artificial Intelligence based technology that allows computers to understand and label images. Use OpenCV to work with image files. Create Face Detection Software. Detect Objects, including corner, edge, and grid detection techniques with OpenCV and Python. Use Python and Deep Learning to build image classifiers. Use Python and OpenCV to draw shapes on images and videos. Create Color Histograms with OpenCV
Python OpenCV Tutorial - Learn Computer Vision with OpenCV and Python: Introduction to OpenCV and Image Processing in Python, Image processing basics, Object detection and tracking, Deep Learning, Facial landmarks and many special applications.
Python Tutorial for Computer Vision and Face Detection with OpenCV: Learn Vision Includes all OpenCV Image Processing Features with Simple Examples. Face Detection, Face Recognition
What is Artificial Intelligence (AI)? AI is the ability of a machine to think like human, learn and perform tasks like a human. Know the future of AI, Examples of AI and who provides the course of Artificial Intelligence?