Computer vision gives machines the ability to understand images and video.

The Vision Problem

Computer vision (CV) aims to extract meaning from visual data. A digital image is a grid of pixels, each holding numbers (a grey level 0–255, or three values for red, green and blue). Humans see effortlessly, but for a machine the same scene is millions of numbers that change with light, angle and occlusion, so vision is a hard inverse problem.

Definition: Computer vision. The field of AI that enables computers to acquire, process, analyse and understand images and video in order to make decisions.

Tasks

Image classification (what is in the picture?), object detection (what and where, with bounding boxes: YOLO, Faster R-CNN), semantic and instance segmentation (label every pixel), face detection and recognition, optical character recognition (OCR), pose estimation, object tracking in video, image captioning, 3D reconstruction, image generation and enhancement and visual question answering.

Classical Pipeline

The classical steps are: image acquisition; pre-processing (noise removal, contrast enhancement, resizing); feature extraction (edges, corners, textures; SIFT, HOG); segmentation; and classification using a learned model. Edge detection applies a small filter (kernel) by convolution: sliding the kernel over the image, multiplying and summing. The kernel [−1, 0, 1] responds strongly where brightness changes from left to right. A CNN learns the filters automatically in many layers: early layers detect edges, middle layers detect parts, deep layers detect objects.

Applications

Face unlock and attendance, medical imaging (tumour and retinopathy detection), self-driving cars (lane and pedestrian detection), industrial inspection of defects, agriculture (crop disease), retail (cashier-less stores), traffic enforcement (number-plate recognition), surveillance, satellite imagery and augmented reality. Concerns: privacy, bias in face recognition and misuse.

Table 4.3: Computer vision tasks

Task Output Example
Classification One label per image Cat or dog
Detection Boxes and labels Pedestrians on a road
Segmentation Label for every pixel Tumour outline
OCR Text from an image Number plates

Example 4.3: Edge detection by convolution

Problem: One image row is [0, 0, 9, 9, 9]. Apply the kernel [−1, 0, 1] at positions 1, 2 and 3 (output = right neighbour − left neighbour).

Solution:

  1. Position 1: 9 − 0 = 9 (neighbours at positions 2 and 0).
  2. Position 2: 9 − 0 = 9 (positions 3 and 1).
  3. Position 3: 9 − 9 = 0 (positions 4 and 2).
  4. High values mark the change from dark to bright; the flat bright area gives 0.

Result: Output [9, 9, 0]: the brightness edge between positions 1 and 2 is detected.

row = [0, 0, 9, 9, 9]
kernel = [-1, 0, 1]
out = [sum(k * row[i + j - 1] for j, k in enumerate(kernel))
       for i in range(1, len(row) - 1)]
print("edge response:", out)
image = [[0, 0, 9, 9, 9]] * 3
print("pixels:", sum(len(r) for r in image))

Output

edge response: [9, 9, 0]
pixels: 15

Common mistakes

  • Treating an image as a few numbers rather than a grid of thousands or millions of pixels.
  • Training a model on images from one condition and expecting it to work everywhere.
  • Confusing detection (where) with classification (what).
  • Ignoring bias in face recognition datasets.

Key takeaways

  • An image is a grid of pixels; vision extracts meaning from them.
  • Tasks: classification, detection, segmentation, OCR, tracking.
  • Convolution with kernels finds edges; CNNs learn the kernels.
  • Applications: medical imaging, self-driving, inspection, security.

Practice questions

  1. What is object detection?
  2. What does a convolution kernel do?
  3. Name two applications of computer vision.

Answers to the practice questions

  1. Finding what objects are in an image and where, usually with bounding boxes.
  2. It slides over an image, multiplying and summing local pixels to detect features such as edges.
  3. Medical image analysis and self-driving cars (also face unlock, OCR).

Sources

  • Official BCA syllabus Artificial Intelligence, course code 26BCA404DS04, Unit IV