CBSE Class 10 Artificial Intelligence – Unit 5: Computer Vision | Complete Notes
Class 10 · Artificial Intelligence
Unit 5: Computer Vision
Computer Vision (CV) is an important domain of Artificial Intelligence that enables machines to understand and interpret visual information such as images and videos.
In this unit, you will learn how computers process images, identify objects, recognise patterns and use Artificial Intelligence to make decisions from visual data.
Topics Covered in This Unit
-
5.1 Introduction to Computer Vision
- CV open-source tool
- A quick overview of Computer Vision
- Computer Vision and Artificial Intelligence
- Computer Vision vs Image Processing
-
5.2 Applications of Computer Vision
- Facial Recognition
- Face Filters
- Google Search by Image
- Computer Vision in Retail
- Self-Driving Cars
- Medical Imaging
- Google Translate App
-
5.3 Computer Vision Tasks
- Classification
- Classification + Localisation
- Object Detection
- Image Segmentation
- Basics of Images and Pixels
- Resolution and Pixel Value
- Grayscale and RGB Images
-
5.4 No-Code AI Tools
- Introduction to Lobe
- Teachable Machine
- Smart Sorter Activity
- Orange Data Mining Tool
- Use Case Walkthrough
- Steps to Project Development
-
5.5 Image Features
- Introduction to Image Features
- Examples
- Conclusion
-
5.6 Convolution
- Convolution
- What is a Kernel?
-
5.7 Convolutional Neural Network
- Introduction
- Convolution Layer
- Rectified Linear Unit
- Pooling Layer
- Fully Connected Layer
-
5.8 Python Libraries in Computer Vision
- TensorFlow
- Keras
- OpenCV
- Applications of OpenCV
5.1 Introduction to Computer Vision
What is Computer Vision?
Computer Vision (CV) is a field of Artificial Intelligence that enables computers to identify, process and understand information present in images and videos.
In simple words, Computer Vision enables a machine to "see" and understand the visual world.
Human Vision vs Computer Vision
| Human | Computer |
|---|---|
| Eyes capture visual information. | Camera or sensor captures visual information. |
| Brain processes the information. | Computer processes pixels and data. |
| Brain identifies objects. | AI model identifies objects. |
| Human understands the scene. | Computer Vision interprets the visual data. |
CV Open-Source Tool
One of the most popular open-source tools used for Computer Vision is OpenCV.
OpenCV stands for Open Source Computer Vision Library. It is a library containing functions and tools for processing images and videos and developing Computer Vision applications.
OpenCV can be used for tasks such as:
- Reading and displaying images
- Processing videos
- Working with webcams
- Face detection
- Object detection
- Image processing
- Real-time Computer Vision applications
Computer Vision and Artificial Intelligence
Computer Vision is a domain of Artificial Intelligence that focuses on understanding visual information.
Artificial Intelligence enables machines to perform tasks that normally require human intelligence. Computer Vision provides AI systems with the ability to analyse images and videos.
Computer Vision vs Image Processing
Image Processing mainly deals with manipulating or enhancing an image, whereas Computer Vision goes further by extracting meaningful information from visual data.
| Computer Vision | Image Processing |
|---|---|
| Focuses on understanding visual information. | Focuses mainly on manipulating or enhancing images. |
| Can identify objects or people. | Can change brightness, contrast or size. |
| Example: Identifying a student from a photograph. | Example: Cropping or resizing a photograph. |
| Can make predictions from visual data. | Usually prepares or modifies the visual data. |
Quick Examples
- Increasing brightness of a photograph → Image Processing
- Detecting a person's face → Computer Vision
- Cropping an image → Image Processing
- Identifying a car in an image → Computer Vision
Case Study: Smart Safety Car
A self-driving car uses a camera at night. The system successfully increases the brightness and contrast of the captured image but fails to identify a pedestrian.
The brightness and contrast adjustment is an example of Image Processing, while identifying the pedestrian requires Computer Vision.
5.2 Applications of Computer Vision
Computer Vision is used in many areas of our daily lives. It helps computers analyse images and videos and perform tasks that previously required human visual intelligence.
1. Facial Recognition
Facial Recognition is a Computer Vision application that identifies or verifies a person using facial characteristics.
Examples include:
- Smartphone face unlock
- Security systems
- Automated attendance systems
- Identity verification
2. Face Filters
Face filters use Computer Vision to identify facial landmarks such as the eyes, nose, mouth and face boundary.
Digital objects such as glasses, hats, masks or animal ears can then be placed over the face.
Example: Social media applications use Computer Vision to apply face filters in real time.
3. Google Search by Image
Search by Image allows users to search for information using an image instead of typing a text query.
Computer Vision analyses visual characteristics of the image and compares them with available visual information.
4. Computer Vision in Retail
Retail businesses use Computer Vision to analyse customers, products and shelves.
- Monitoring customer movement
- Checking product availability
- Inventory management
- Analysing shelf arrangements
- Improving shopping experiences
5. Self-Driving Cars
Self-driving cars use cameras and other sensors to understand their surroundings.
Computer Vision can help detect:
- Pedestrians
- Other vehicles
- Traffic lights
- Road signs
- Road obstacles
6. Medical Imaging
Computer Vision can analyse medical images such as X-rays, CT scans and MRI images to assist medical professionals.
Such systems can help identify patterns and abnormalities in medical images and support doctors in analysis.
7. Google Translate App
Google Translate can use a smartphone camera to recognise text contained in an image and translate it into another language.
Application Summary
| Application | Use of Computer Vision |
|---|---|
| Facial Recognition | Identifying or verifying people |
| Face Filters | Detecting facial landmarks |
| Google Search by Image | Searching using visual information |
| Retail | Product and customer analysis |
| Self-Driving Cars | Detecting vehicles, pedestrians and road objects |
| Medical Imaging | Analysing medical images |
| Google Translate | Recognising and translating text from images |
Case Study: Smart Library
A school library installs a camera at the book-return counter. The system identifies whether a book belongs to Science, History or Fiction and places a box around the book.
The system is using Computer Vision for classification and localisation/object detection.
5.3 Computer Vision Tasks
Computer Vision performs different tasks depending upon what information needs to be extracted from an image.
1. Classification
Classification assigns an image to a particular class or category.
It answers the question: "What is this image?"
Example: An image is classified as "Cat".
Other examples:
- Rose / Lily / Sunflower
- Healthy / Diseased
- Cat / Dog
- Fruit / Junk Food
2. Classification + Localisation
Classification + Localisation identifies what an object is and where it is located in an image.
It is generally used when there is a single object of interest.
Example: Identify a cat and draw a bounding box around it.
3. Object Detection
Object Detection identifies and locates multiple objects in an image or video.
Each detected object can have its own label and bounding box.
Example: A self-driving car may detect a pedestrian, two cars and a traffic light in the same image.
4. Image Segmentation
Image Segmentation divides an image into meaningful regions or identifies the pixels belonging to particular objects.
Instead of simply drawing a rectangular box around an object, segmentation can identify the exact shape of the object at the pixel level.
Computer Vision Tasks – Quick Comparison
| Task | What does it answer? | Example |
|---|---|---|
| Classification | What is the object/image? | Cat |
| Classification + Localisation | What is it and where is it? | Cat + one bounding box |
| Object Detection | What objects are present and where? | Car + person + traffic light |
| Image Segmentation | Which pixels belong to each object? | Exact shape of a person |
Basics of Images and Pixels
What is a Pixel?
The word Pixel is derived from Picture Element.
A pixel is the smallest unit of information in a digital image. Digital images are made up of many pixels arranged in a two-dimensional grid.
Resolution
Resolution refers to the number of pixels present in an image, generally represented by its width and height.
For example, a resolution of 1920 × 1080 means:
- Width = 1920 pixels
- Height = 1080 pixels
Total pixels: 1920 × 1080 = 2,073,600 pixels
Megapixel
1 Megapixel (MP) = 1 million pixels.
Therefore, a 12 MP camera can capture approximately 12 million pixels in an image.
Pixel Value
A pixel has a numerical value representing its brightness or colour.
In a standard 8-bit image, pixel values range from 0 to 255.
| Pixel Value | Meaning in Grayscale |
|---|---|
| 0 | Black |
| 128 | Medium Gray |
| 255 | White |
Grayscale Images
A grayscale image contains shades of gray rather than colours.
Each pixel generally has one value between 0 and 255.
- 0 → Black
- 255 → White
- Values between 0 and 255 → Different shades of gray
RGB Images
A coloured image can be represented using three colour channels: Red, Green and Blue (RGB).
Each pixel contains three values: one for Red, one for Green and one for Blue.
| R | G | B | Result |
|---|---|---|---|
| 0 | 0 | 0 | Black |
| 255 | 255 | 255 | White |
| 255 | 0 | 0 | Red |
| 0 | 255 | 0 | Green |
| 0 | 0 | 255 | Blue |
RGB image → 3 channels
Case Study: Smart Refrigerator
A smart refrigerator has a camera that identifies Milk, Apple and Eggs and places a box around each item.
This is an example of Object Detection because multiple objects are identified and located.
If the system had to identify the exact pixels belonging to the liquid inside a bottle, it would require Image Segmentation.
5.4 No-Code AI Tools in Computer Vision
Traditional AI development may require programming knowledge. No-Code AI tools provide visual interfaces that allow users to create AI models with little or no programming.
Introduction to Lobe
Lobe is a no-code/low-code machine learning tool that makes it easier to train image classification models.
Users can provide labelled images and train a model without manually writing the machine learning algorithm.
Typical process:
- Collect images.
- Assign labels to images.
- Train the model.
- Test the model.
- Use or export the trained model.
Teachable Machine
Teachable Machine is a web-based tool developed by Google that allows beginners to train simple machine learning models.
It can be used for:
- Image recognition
- Sound recognition
- Pose recognition
It is particularly useful for students because models can be trained using a simple visual interface.
Smart Sorter Activity
The Smart Sorter activity demonstrates how Computer Vision can be used to automatically classify different types of waste.
Suppose a smart waste sorter has three categories:
- Bottles
- Cans
- Paper
The project can follow these steps:
- Collect images of bottles, cans and paper.
- Label the images according to their categories.
- Train the AI model.
- Test the model with new images.
- Improve the training data if incorrect predictions occur.
Orange Data Mining Tool
Orange Data Mining is an open-source tool that allows users to build data analysis and machine learning workflows using a visual interface.
Orange uses Widgets as building blocks. Widgets can be connected on a visual canvas to create a workflow.
| Widget | Purpose |
|---|---|
| File | Load or import data |
| Data Table | View data in rows and columns |
| Scatter Plot | Visualise relationships between variables |
| Test & Score | Evaluate machine learning models |
Use Case Walkthrough: Coral Bleaching
Coral reefs are important marine ecosystems. Environmental stress can cause coral bleaching.
Computer Vision can help researchers classify coral images as Healthy or Bleached.
A no-code tool can be used to train a model using labelled images. New images can then be tested to determine whether the coral appears healthy or bleached.
Steps to Project Development
A Computer Vision project using a no-code tool can follow the AI Project Cycle.
- Data Acquisition: Collect or import suitable images.
- Data Exploration: Examine the images and check whether the data is useful and properly labelled.
- Modelling: Train an appropriate machine learning model.
- Evaluation: Test the model and determine how well it performs.
Case Study: Cafeteria Fruit Scanner
A school cafeteria uses Lobe to classify food as Fruit or Junk Food. The system frequently classifies oranges as cookies because both can appear round and yellowish.
The problem may be caused by insufficient or unsuitable training data. The model needs more representative images showing oranges and cookies from different angles, backgrounds and conditions.
5.5 Image Features
What is an Image Feature?
An image feature is a characteristic or visual pattern in an image that can help a computer analyse or identify an object.
Features can include structures such as:
- Edges
- Corners
- Shapes
- Patterns
- Textures
- Colours
Types of Image Regions
| Region | Description | Usefulness as a Feature |
|---|---|---|
| Flat Surface | Large region with little or no variation | Usually difficult to locate precisely |
| Edge | Boundary between two regions | More useful than a flat surface |
| Corner | Point where edges meet | Highly useful and distinctive |
Flat Surfaces
A flat surface contains very little change in pixel values. Examples include a plain wall or a clear blue sky.
Since many parts of a flat surface look similar, it can be difficult for a computer to identify a specific location on it.
Edges
An edge is a boundary where there is a significant change in intensity or colour.
Examples include the edge of a building, table or window.
Corners
A corner is a point where two or more edges meet. Corners are generally more distinctive than flat surfaces and straight edges.
Example: Library Book Finder
Suppose two books have plain red covers. The red areas contain little variation, so they provide few useful features.
Another book has a title written in a sharp, distinctive font. The letters create many edges and corners, making the book easier to identify.
5.6 Convolution
What is Convolution?
Convolution is a mathematical operation used in image processing and Computer Vision to extract useful information or apply effects to an image.
It involves applying a small matrix called a Kernel or Filter to different parts of an image.
How Convolution Works
An image can be represented as an array of pixel values. A kernel is another small array.
The kernel moves across the image and performs:
- Element-wise multiplication between the image region and kernel.
- Addition of the resulting values.
- Generation of a new output pixel.
What is a Kernel?
A Kernel is a small matrix used during convolution to extract particular features or apply a particular effect to an image.
Different kernels can be designed for:
- Edge detection
- Blurring
- Sharpening
- Other image-processing operations
Padding
When a kernel moves across an image without padding, the output can become smaller because the kernel cannot completely cover the boundary pixels.
Padding adds extra pixels around the boundary of an image so that convolution can be performed near the edges.
A common type of padding uses zeros around the boundary.
Case Study: Blurry Robot Camera
A robot needs to follow a black line on a white floor. Its camera produces a noisy image. The developer applies a blur filter before detecting the line.
The blur filter can be applied using convolution. A suitable kernel averages neighbouring pixel values and reduces unwanted noise.
5.7 Convolutional Neural Network (CNN)
Introduction to CNN
A Convolutional Neural Network (CNN) is a type of Deep Learning neural network particularly useful for analysing images and other visual data.
CNNs can automatically learn important features from images and use these features to classify or recognise objects.
For example, a CNN may learn simple features such as edges in the early layers and progressively learn more complex features such as shapes and objects in deeper layers.
Main Layers of a CNN
- Convolution Layer
- ReLU Layer
- Pooling Layer
- Fully Connected Layer
1. Convolution Layer
The Convolution Layer applies filters or kernels to the input image to extract useful features.
Initial convolution layers generally detect low-level features such as:
- Edges
- Lines
- Colours
- Simple patterns
Deeper layers can combine these simple features to identify more complex patterns and shapes.
The output produced by convolution is commonly called a Feature Map or Activation Map.
2. Rectified Linear Unit (ReLU)
ReLU stands for Rectified Linear Unit.
It is an activation function commonly used in neural networks. ReLU replaces negative values with zero while retaining positive values.
| Input | ReLU Output |
|---|---|
| -5 | 0 |
| -2 | 0 |
| 0 | 0 |
| 3 | 3 |
| 8 | 8 |
3. Pooling Layer
The Pooling Layer reduces the spatial dimensions of feature maps while retaining important information.
The two common types are:
- Max Pooling – selects the maximum value.
- Average Pooling – calculates the average value.
| Pooling Type | Operation |
|---|---|
| Max Pooling | Selects the largest value from the region. |
| Average Pooling | Calculates the average of values in the region. |
Pooling helps to:
- Reduce the size of feature maps.
- Reduce computational requirements.
- Retain important features.
- Provide some resistance to small changes in position.
4. Fully Connected Layer
The Fully Connected (FC) Layer generally performs the final classification based on the features extracted by earlier layers.
The feature maps can be flattened into a vector and passed to the fully connected layer.
The output can provide probabilities or scores for different classes.
Example: A trained CNN may determine that an image has a high probability of being a "Cat" rather than a "Dog".
CNN Workflow
Input Image → Convolution → ReLU → Pooling → Fully Connected Layer → Output
CNN Layer Summary
| Layer | Main Function |
|---|---|
| Convolution | Extracts features using filters/kernels |
| ReLU | Introduces non-linearity by removing negative values |
| Pooling | Reduces spatial dimensions while retaining important information |
| Fully Connected | Performs final classification |
Low-Level vs High-Level Features
| Early Layers | Later Layers |
|---|---|
| Edges | Complex shapes |
| Lines | Object parts |
| Basic colours | Complete objects |
| Simple patterns | Faces, animals, vehicles etc. |
Case Study: Animal Shelter App
A student develops an application that identifies dog breeds from photographs. A rule-based system performs poorly when lighting and viewing angles change.
A CNN can learn visual features from training data and can therefore be more suitable for such image-recognition tasks.
The initial convolution layers can detect low-level features such as edges and colours, while deeper layers can learn more complex patterns.
5.8 Python Libraries in Computer Vision
Professional Computer Vision applications often use programming languages such as Python along with specialised libraries.
A library is a collection of pre-written functions and tools that programmers can use instead of creating everything from scratch.
1. TensorFlow
TensorFlow is an open-source framework developed by Google and widely used for machine learning and deep learning.
It can be used for:
- Training neural networks
- Deep Learning
- Image classification
- Computer Vision applications
2. Keras
Keras is a high-level deep learning API that provides a simpler interface for building neural networks.
Keras can be used to create models containing layers such as convolution and pooling layers.
TensorFlow → Powerful machine learning/deep learning framework
Keras → Easier interface for building neural networks
3. OpenCV
OpenCV stands for Open Source Computer Vision Library.
It is an open-source library widely used for Computer Vision and image-processing applications.
OpenCV can work with:
- Images
- Videos
- Webcams
- Real-time visual information
Applications of OpenCV
| Application | Possible Use of OpenCV |
|---|---|
| Facial Recognition | Detecting and analysing faces |
| Face Filters | Detecting facial landmarks |
| Self-Driving Cars | Processing camera images and detecting road objects |
| Retail | Analysing products and customer movement |
| Medical Imaging | Processing and analysing medical images |
| Agriculture | Analysing crop images and detecting visual patterns |
TensorFlow vs Keras vs OpenCV
| Library / Framework | Main Purpose |
|---|---|
| TensorFlow | Machine Learning and Deep Learning |
| Keras | Building neural networks using a high-level interface |
| OpenCV | Image processing and Computer Vision |
Case Study: Social Distancing Monitor
A school wants to monitor whether students are maintaining an appropriate distance in a queue. A Python-based system uses a camera to capture video frames and an AI model to identify people.
OpenCV can be used for acquiring and processing the camera frames, while TensorFlow/Keras can be used to build or run a neural network model for visual recognition.
Quick Revision – Unit 5
| Concept | Remember |
|---|---|
| Computer Vision | Enables machines to understand visual information. |
| OpenCV | Open-source Computer Vision library. |
| Pixel | Smallest unit of a digital image. |
| Resolution | Number of pixels represented by image dimensions. |
| Grayscale | One channel; usually values from 0 to 255. |
| RGB | Three channels: Red, Green and Blue. |
| Classification | Identifies the class/category of an image. |
| Localisation | Identifies the location of an object. |
| Object Detection | Identifies and locates multiple objects. |
| Segmentation | Identifies object regions at the pixel level. |
| Lobe | No-code tool useful for image classification. |
| Teachable Machine | Google's beginner-friendly web-based AI training tool. |
| Orange | Visual, open-source data mining and machine learning tool. |
| Image Feature | Useful visual characteristic such as an edge or corner. |
| Convolution | Applies a kernel to image regions using mathematical operations. |
| Kernel | Small matrix/filter used during convolution. |
| CNN | Deep Learning network designed especially for visual data. |
| ReLU | Converts negative values to zero. |
| Pooling | Reduces spatial dimensions while retaining important information. |
| TensorFlow | Machine Learning and Deep Learning framework. |
| Keras | High-level API for building neural networks. |
Important Differences for Examination
Computer Vision vs Image Processing
| Computer Vision | Image Processing |
|---|---|
| Understands visual information. | Manipulates or enhances images. |
| Can identify objects. | Can resize, crop or enhance images. |
| Example: Face detection. | Example: Brightness adjustment. |
Classification vs Object Detection
| Classification | Object Detection |
|---|---|
| Identifies the class/category. | Identifies and locates objects. |
| Usually gives a label for the image. | Can give labels and bounding boxes. |
| Example: Cat. | Example: Cat + Dog + Bird with boxes. |
Grayscale vs RGB
| Grayscale | RGB |
|---|---|
| One channel. | Three channels. |
| Contains shades of gray. | Contains colour information. |
| Pixel values generally range from 0 to 255. | Each pixel has R, G and B values. |
Convolution vs Pooling
| Convolution | Pooling |
|---|---|
| Uses filters/kernels to extract features. | Reduces spatial dimensions. |
| Produces feature maps. | Retains important information while reducing size. |
| Helps detect features such as edges. | Uses operations such as maximum or average. |
Competency-Based and Case Study Questions
MCQ 1
Which of the following is an example of Computer Vision?
- Changing the brightness of an image
- Cropping a photograph
- Detecting a pedestrian in a road image
- Resizing an image
MCQ 2
Which tool is an open-source Computer Vision library?
- Keras
- OpenCV
- Excel
- PowerPoint
MCQ 3
Which Computer Vision task identifies multiple objects and their locations in an image?
- Classification
- Object Detection
- Image Resizing
- Image Compression
MCQ 4
What is the maximum pixel value in a standard 8-bit grayscale image?
- 0
- 128
- 255
- 512
MCQ 5
Which CNN layer reduces the spatial dimensions of feature maps?
- Pooling Layer
- Fully Connected Layer
- ReLU Layer
- Input Layer
Assertion and Reasoning
Assertion (A): Computer Vision can be used for facial recognition.
Reason (R): Computer Vision can analyse visual characteristics of faces.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- Both A and R are false.
Case Study: Smart Traffic System
A city installs cameras at traffic intersections. The Computer Vision system identifies cars, buses, pedestrians and traffic lights.
Questions:
- Which Computer Vision task is being used?
- Why is object detection more suitable than simple classification?
- Object Detection.
- Because the system must identify multiple objects and determine their locations in the scene.
Case Study: Google Translate
A student travels to another country and points a smartphone camera at a sign written in a foreign language. The application recognises the text and displays its translation.
Question: Which technology helps recognise the text?
Case Study: Image Resolution
A photograph has a resolution of 1280 × 720.
Question: How many pixels does the image contain?
1280 × 720 = 921,600 pixels
Case Study: Smart Waste Sorter
A school uses Teachable Machine to classify waste into paper, cans and bottles. During testing, the system incorrectly identifies some bottles as cans.
Question: What can the school do to improve the model?
One-Minute Exam Revision
OpenCV → Open-source Computer Vision library.
Pixel → Smallest unit of a digital image.
Resolution → Width × Height in pixels.
Grayscale → One channel, usually 0–255.
RGB → Red + Green + Blue channels.
Classification → What is it?
Localisation → Where is it?
Object Detection → What objects + where are they?
Segmentation → Which pixels belong to the object?
Lobe → No-code image classification tool.
Teachable Machine → Google web-based no-code AI tool.
Orange → Visual, open-source data mining tool.
Feature → Useful visual characteristic such as edge/corner.
Convolution → Image + Kernel → Feature information.
Kernel → Small filter/matrix used in convolution.
ReLU → Negative values become zero.
Pooling → Reduces spatial dimensions.
Fully Connected Layer → Final classification.
TensorFlow → Machine Learning / Deep Learning framework.
Keras → High-level neural network API.
OpenCV → Image and video processing / Computer Vision.
Key Terms to Remember
Computer Vision, Image Processing, OpenCV, Pixel, Resolution, Grayscale, RGB, Classification, Localisation, Object Detection, Image Segmentation, Lobe, Teachable Machine, Orange, Image Feature, Edge, Corner, Convolution, Kernel, Padding, CNN, Convolution Layer, ReLU, Pooling, Fully Connected Layer, TensorFlow, Keras, OCR.