Computer Vision Lab Lessons Introduction to image processing
Introduction to image processing
Point, local and global operations: how we change an image to improve it or prepare it for models.
This content was prepared automatically from documented sources and its human scientific review is not yet complete. If you find an error, let us know.
Introduction
Image processing turns one image into another, or into information. It is the step that precedes most vision systems.
Learning objectives
- Distinguish point, local and global operations.
- Apply brightness, contrast and gamma.
- Understand saturation and clipping.
Prerequisites
Digital image basics.
Scientific explanation
A point operation depends on the pixel's value alone (brightness, gamma, inversion). A local operation depends on the pixel's neighbourhood (filters, edges). A global operation depends on the whole image (global histogram equalisation, normalisation). Any operation that produces values outside 0–255 needs clipping or rescaling.
In-depth explanation
Classifying processing operations
Image processing operations can be classified by "what they need" to compute the output pixel:
| Type | Depends on | Examples |
|---|---|---|
| Point | The pixel's own value only | Brightness, contrast, gamma, thresholding, histogram equalisation |
| Local (neighbourhood) | The pixel's neighbourhood | Smoothing, edges, morphology |
| Global | The whole image | Fourier transform, Otsu, min-max normalisation |
| Geometric | The pixel's position | Rotation, resizing, registration |
All point operations can be implemented with a lookup table (LUT) of 256 values for 8-bit images, so their cost is one read per pixel however complex the function is.
Point operations as functions
A point operation is a function s = T(r) from the original intensity to the new one, and its effect is understood from its curve: a slope greater than 1 increases contrast in that range, and less than 1 compresses it. A monotonically increasing function preserves the order of intensities, so it does not swap light and dark.
\text{linear: } s=\alpha r+\beta,\qquad \text{gamma: } s = 255(r/255)^\gamma,\qquad \text{log: } s = c\log(1+r)Worked example
An image whose values lie only between 60 and 180. To stretch it linearly to 0–255: \alpha = 255/(180-60) = 2.125 and\beta = -60\alpha = -127.5. So pixel 120 becomes 2.125\times120-127.5 = 127.5 that is, the middle of the range, as expected.
Where does processing sit in the modern vision pipeline?
- Before the model: resizing, normalisation, CT windowing, and sometimes CLAHE.
- During training: augmentation (brightness, contrast, gamma, smoothing) to increase robustness.
- After the model: probability thresholding, morphology to clean masks, NMS.
Review questions
- Why is a LUT enough to implement any point operation?
- Which of the following operations is local: Otsu, median, gamma?
- Design a transform that inverts the image (the negative) and write its equation.
Mathematical equations
Brightness and contrast: g = sat(|α·f + β|). Gamma: g = 255·(f/255)^γ.
Practical example
A dark image: γ = 0.6 reveals shadow detail, and α = 1.3 with β = 15 increases contrast and brightness together.
Implementation steps
- Choose "Brightness and contrast" in the processing lab.
- Move α and β and watch the histogram.
- Try gamma with values below and above 1.
Expected results
The histogram widens as α increases and shifts with β, and values pile up at 255 when overdone (saturation).
Common mistakes
Overdoing contrast erases bright details, and forgetting that operations do not add information that is not there.
Practical applications
Enhancing images before display, data augmentation in training.
References
- R. Szeliski (2022).Computer Vision: Algorithms and Applications (2nd ed.). Springer, Texts in Computer Science. doi:10.1007/978-3-030-34372-9
- OpenCV (2024).OpenCV documentation: Image Processing (imgproc module). docs.opencv.org. docs.opencv.org
