Page 300 - Ai_C10_Flipbook
P. 300
[1]: ps.stem('learning')
'learn'
Lemmatization is the process of extracting a base word called lemma. It is considered a better way than stemming
because stemming just removes the suffix without considering the actual meaning of the word.
It is done using WordNetLemmatizer package:
[1]: from nltk.stem.wordnet import WordNetLemmatizer
Lem = WordNetLemmatizer()
Lem.lemmatize("studies")
'study'
OpenCV
OpenCV stands for Open-Source Computer Vision Library, originally developed by Intel and officially launched
in 1999. It is an open-source software library for computer vision and Machine Learning that helps a computer
understand the content of digital images like photographs and videos.
It helps in processing images and videos to identify objects, faces, or even handwriting. It supports a wide variety of
programming languages like Python, C++, Java, etc. and is available on almost all platforms. We will use OpenCV
for basic image processing operations on images such as resizing, cropping and many more.
Let us first see how we can install it in our computer:
• Open Anaconda prompt and write the following command:
pip install opencv-python
Make sure you download the get-pip.py file and store it in the same directory as python is installed before you
install OpenCV.
Brainy Fact
Stanford’s robot “Stanley” used OpenCV and was declared the winner of the DARPA Grand Challenge in 2005.
This challenge is a prize competition for American autonomous vehicles, funded by the Defense Advanced
Research Projects Agency.
The imread() Function in OpenCV
The imread() function read the image and loads it into the computer’s memory. Syntax of imread() function
is: cv2.imread(path, flag)
Where,
• path is the path of the image to be read. If the file is in the working directory, then write only the name and the
extension of the image otherwise it is a must to specify the complete path.
• flag is the way how our image should be read.
The value can be:
1-(default) It reads image in BGR format where it has bluish appearance.
0-It reads image in Grayscale format.
-1-It reads image in original format.
298 Artificial Intelligence Play (Ver 1.0)-X

