Dev.to AI 🤖 Ai 👁 0 📖 7 min read

Introduction to Computer Vision

Computer vision is the technology that teaches computers to understand pictures and videos. Look at a photo of a coffee cup and you know right away what it is. You may even guess the coffee is hot. A computer sees none o

Computer vision is the technology that teaches computers to understand pictures and videos. Look at a photo of a coffee cup and you know right away what it is. You may even guess the coffee is hot. A computer sees none of that. It sees only numbers, and computer vision is the set of ideas that turns those numbers into meaning.
In this post, we explain how computers "see", the main tasks they can do, why this field is growing so fast, and how it is already helping people across Africa.
What a computer really sees
A digital photo is a grid of tiny squares called pixels. Each pixel is stored as three numbers: how much red, green and blue it contains. Each number goes from 0 to 255.
So even a small photo, 400 pixels wide and 600 pixels tall, holds 400 × 600 × 3 = 720,000 numbers. A modern phone photo holds more than 30 million. The big challenge of computer vision is to go from all these numbers to real meaning.

You can think of a colour image as three grids stacked on top of each other: one for red, one for green and one for blue. A red cup looks bright in the red grid and dark in the blue grid.

Three questions every vision system answers
Computer vision lets computers get meaning from images and video. Almost every system answers one or more of these questions:
• What is in the picture? For example, a cat or a cassava leaf.
• Where is it? Which part of the picture, or which pixels.
• What is happening? For example, a person crossing the road. This is mostly for video.
Humans and computers see differently
Humans

  1. Years of seeing the world 2.Understanding context, learning from few examples 3.Getting tired Computers
  2. Millions of labelled images 2.Speed and working at large scale 3.Things that look different from their training images

A computer can check thousands of X-rays in a day without getting tired. But it can easily fail on something it has never seen before. We will come back to this later.
Five core tasks
Most computer vision work falls into five tasks:

  1. Classification: give one label to the whole image.
  2. Detection: draw a box around each object.
  3. Segmentation: give a label to every single pixel.
  4. OCR: read the text inside an image.
  5. Tracking: follow objects from one video frame to the next.

Here is an example. Take one photo of a street. A classifier may say "minibus" and be 57% sure. That is not wrong, but it is not very useful. A detector will find one bus and four people and draw boxes around them. A segmenter will outline exactly which pixels belong to each object. The more detail you want, the more detailed the training labels must be, and the more it costs to create them.
How a computer finds patterns
The first step is to find edges, the places where brightness changes. To do this, we use a filter. A filter is a small grid of numbers. We slide it over the image, multiply each pixel by the matching number, and add up the results. This operation is called convolution.
Here is a simple example. The filter below is called a Sobel filter. It subtracts the left side from the right side:
-1,0,1
-2,0,2
-1,0,1
• On a flat area where every pixel is 100, the left side gives −400 and the right side gives +400. The total is 0, so there is no edge.
• On an area that goes from dark (0) to bright (200), the left side gives 0 and the right side gives +800. The big number tells us there is an edge.
Other filters can blur a picture or make it sharper. In code, a blur is just a 5 × 5 grid of ones divided by 25, which means each pixel becomes the average of the 25 pixels around it.
Letting the computer learn its own filters
In the past, people designed filters by hand. Today we use a convolutional neural network (CNN), which learns its own filters from labelled examples. Nobody designs them. The network builds up understanding step by step:
Pixels → Edges → Textures → Objects
The first layers find simple edges and colours. The middle layers find textures and parts, like eyes or wheels. The last layers recognise whole objects.
Finding objects fast with YOLO
Older detectors, such as R-CNN, worked in two steps. First they looked for regions that might contain an object, then they classified each region. This was accurate but slow.
YOLO stands for "You Only Look Once". It looks at the whole image one time and predicts every box and label together. This is fast enough for live video and for small devices. It was introduced in 2015 by Joseph Redmon and his colleagues.
Why computer vision is growing now
Five things came together at the same time:
• Cameras everywhere: every phone is a camera and a small computer.
• Data: there are huge image collections, including satellite images of whole continents.
• Computing power: cloud GPUs train big models, and small models can run on cheap phones with no internet.
• Pretrained models: you do not start from zero. You can adapt an existing model with a few thousand local photos.
• Multimodal AI: AI assistants can now read images as well as text.
There is also a link with language AI. A Vision Transformer cuts an image into small 16 × 16 patches and treats each patch like a word. A 224 × 224 image becomes 196 patches. Then the same attention method used for text reads the picture.
Computer vision across Africa
Computer vision is already solving real problems on the continent. Here are six examples.
• Farming (East Africa): The Nuru app helps farmers find crop diseases. A farmer takes a photo of a cassava leaf and the app names the disease and gives advice. It works offline on a basic phone, so it is useful in fields with no internet. Task: image classification.
• Health (Nigeria): In 2022, software scored the chest X-rays of 5,298 people in Gombe and Adamawa. People with a high score got a lab test, and 85 people with TB were found. Task: classification with a threshold.
• Conservation (Gabon): A small computer next to a camera trap spots elephants and people, then sends an alert to rangers by satellite within minutes. Task: object detection "at the edge", meaning on the device itself.
• Finance (6 countries): Smile ID matches a selfie to an ID photo and checks that the person is real and live. It handled more than 1 million identity checks per month in 2021. Tasks: face verification and OCR.
• Mapping (whole continent): Google's Open Buildings project found 1.8 billion building outlines from satellite images. Health teams use them to plan vaccination campaigns, and aid teams use them after floods. Task: segmentation.
• Accessibility (Kigali): BLAIVA, built by FabLab Rwanda and still in beta testing, is a wearable camera that describes objects, text and faces through earphones. Tasks: detection, OCR and face recognition.
When computer vision fails
A model only knows what it was trained on. In one test on a street photo, the model found "1 bus, 4 people". Then the photo was changed:
• Very dark: the model added a skateboard that was not there.
• Upside down: the model missed the bus.
• Very low resolution: the model found nothing.
Many popular models were trained mostly on photos from Europe, North America and Asia. They can make more mistakes on African crops, clothes, roads, skin tones and lighting. Early face recognition systems, for example, often worked worse on darker skin because the training data was not representative. Face data is also very private, so it needs great care.
The fix is local data. When a model is adapted with local photos, it works better for local people. It is also important to ask who could be harmed if a model is wrong: a farmer, a patient or a customer.
Tools to get started
You rarely need to start from zero. These tools are popular:
• PyTorch: build and train your own neural networks.
• TensorFlow / Keras: Google's alternative, common in mobile apps.
• Hugging Face: download pretrained models and adapt them.
• Ultralytics YOLO: ready-made detection, classification and segmentation.
Key takeaways
• Images are just numbers: height × width × 3.
• Filters find patterns, and CNNs learn the filters by themselves.
• The main tasks are classification, detection and segmentation.
• Computer vision is already used in farming, health, conservation, finance, mapping and accessibility across Africa.
• Models fail on things they have not seen, so local data matters.
A good way to start is to take 5 to 10 photos of your own surroundings, such as a street, a market stall or a crop leaf, and run them through a pretrained model. Notice what it gets right and what it misses. That is the best way to understand both the power and the limits of computer vision.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.