Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
What is Image Processing?
Image processing is a set of operations that transform an input image into an output image (or numerical result). Every CV pipeline starts with image processing to clean, prepare, and transform raw images.
What is Image Processing?
Image processing is the manipulation of digital images using mathematical operations to:
- Improve image quality (remove noise, enhance contrast)
- Prepare images for analysis (resize, normalise, convert colour)
- Extract information (edges, shapes, text)
- Transform images (rotate, flip, warp)
Image processing is the foundation layer of Computer Vision. Before a model can detect objects or recognise faces, the raw image typically needs processing.
There are two levels of image processing:
- Low-level: basic pixel operations (brightness, blur, resize)
- Mid-level: structural operations (edges, contours, segmentation)
- High-level: understanding (object detection, scene recognition) — covered in later modules
Machine Learning follows a structured pipeline from data to deployment
A Basic Processing Pipeline
import cv2
import numpy as np
# A typical image processing pipeline:
# Step 1: Load
image = cv2.imread("photo.jpg")
# Step 2: Resize to standard dimensions
resized = cv2.resize(image, (640, 480))
# Step 3: Convert to grayscale (many algorithms work on grayscale)
gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY)
# Step 4: Reduce noise with blur
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
# Step 5: Apply threshold to get binary image
_, binary = cv2.threshold(blurred, 127, 255, cv2.THRESH_BINARY)
# Step 6: Save result
cv2.imwrite("processed.png", binary)
print("Pipeline complete: load → resize → grayscale → blur → threshold → save")