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!
Image Resolution
Image resolution describes how much detail an image holds. Higher resolution means more pixels, more detail, and larger file sizes.
What is Image Resolution?
Resolution refers to the total number of pixels in an image. It is usually expressed as width × height.
Common resolutions:
- 640×480 (VGA): old webcam quality
- 1280×720 (HD): basic video
- 1920×1080 (Full HD): standard monitor / video
- 3840×2160 (4K): modern TV / camera
- 12 megapixels: 4000×3000 — typical smartphone photo
Higher resolution = more pixels = more detail, but also:
- Larger file size
- More memory required to process
- Slower processing speed
In Computer Vision, images are often resized to a standard resolution (e.g. 224×224 or 416×416) before being fed into a model, to ensure consistent input size.
Machine Learning follows a structured pipeline from data to deployment
Resizing for CV Pipelines
import cv2
image = cv2.imread("photo.jpg")
print(f"Original: {image.shape[1]}x{image.shape[0]}")
# Resize to 224x224 (common input size for CNN models)
resized = cv2.resize(image, (224, 224))
print(f"Resized: {resized.shape[1]}x{resized.shape[0]}")
# Resize to half the original size
half_width = image.shape[1] // 2
half_height = image.shape[0] // 2
half_size = cv2.resize(image, (half_width, half_height))
print(f"Half size: {half_size.shape[1]}x{half_size.shape[0]}")
# INTERPOLATION METHODS:
# cv2.INTER_LINEAR — default, good for enlarging
# cv2.INTER_AREA — best for shrinking (avoids aliasing)
# cv2.INTER_CUBIC — high quality, slower