beginner · python

Computer Vision with Python

An applied introduction to computer vision using Python and lightweight tools such as OpenCV and torchvision. Learners progress from image representation and preprocessing through feature extraction, classification, CNNs, and model evaluation.

What you could build

  • A handwritten digit classifier using image preprocessing and supervised learning.
  • A document scanner that detects page boundaries and performs perspective correction.
  • A color-based object detector for locating selected objects in photographs.
  • An image similarity tool that ranks pictures by visual features.
  • A webcam-based image classifier trained on a small set of custom categories.

You pick the project at the start — these are examples, not a fixed list.

What you'll be able to do

  • Inspect, load, transform, and save images in Python while reasoning about array shape, data type, coordinates, color channels, and value ranges.
  • Apply preprocessing operations such as resizing, cropping, rotation, thresholding, smoothing, and convolution, and predict how each changes an image.
  • Explain and analyze visual features including gradients, edges, corners, blobs, keypoints, local descriptors, and feature matches.
  • Compare classical image classifiers such as k-nearest neighbors, decision trees, and support vector machines using train-test splits, scaling, cross-validation, and confusion matrices.
  • Trace how a CNN learns visual representations and evaluate image-classification models using accuracy, precision, recall, F1 score, leakage checks, class-balance analysis, and error analysis.

Who this is for

This course is for learners with basic Python experience who want a practical foundation in computer vision, from manipulating image arrays to training and evaluating classical and CNN-based classifiers. It fits learners who want to understand both the visual concepts and the reasoning behind common OpenCV and torchvision workflows.

What you should already know

  • Basic Python programming, including functions, imports, loops, and working with simple data structures.
  • Basic familiarity with NumPy arrays and indexing.
  • A general understanding of averages, distances, and reading simple graphs or tables.

How a lesson actually goes

Lesson 1
TutorLet’s begin with image representation. A digital image is a grid of measurements: each pixel records visual information at a particular row and column, and color images usually store several channel values at that location. Before we discuss models, what do you think the numbers in an image array represent?
YouI think they are the colors of the image. For a color image, maybe each pixel is one number that tells us how bright it is.
TutorYou have the right idea that the numbers encode appearance, but a color pixel usually needs multiple numbers rather than one. In an RGB image, one location has three measurements—red, green, and blue—so an array might have shape height × width × 3. A grayscale image typically has one intensity measurement per location.
YouSo if the array shape is 100 by 200 by 3, that means 100 rows, 200 columns, and three color values for each pixel?
TutorExactly. The first two dimensions describe the image’s spatial layout, while the last dimension identifies the channels. Now let’s check one subtle point: if a pixel’s RGB values are [255, 0, 0] in an 8-bit image, what color does it represent, and what does the 255 tell you?

Written from this course's first lesson to show the format — not a recording of a real session.

Course content

marks each module's capstone lesson.

01Image Foundations10 lessons

This module introduces how digital images are represented, stored, and accessed in Python. Learners will build a precise mental model of pixels, channels, color spaces, resolution, file formats, NumPy arrays, and image coordinates before applying preprocessing and vision algorithms.

  • Course Introduction

    Welcome and orientation: overview of the learning path, key outcomes, and how modules build from image representation through preprocessing, feature extraction, classification, neural networks, and evaluation.

  • Image Representation

    A digital image is a structured collection of samples rather than a continuous visual scene. This concept establishes how spatial position and measured intensity become numerical image data.

  • Pixels

    Pixels are the individual spatial samples that make up an image. Their values encode visual properties such as brightness or color at particular image locations.

  • Color Channels

    Color images store separate measurements for component channels, while grayscale images use a single intensity channel. Understanding channel structure is essential for interpreting image shapes and values in Python.

  • Color Spaces

    A color space defines how colors are encoded numerically. RGB separates color by additive components, while HSV separates hue, saturation, and value to describe color characteristics differently.

  • Image Resolution

    Resolution describes the number of samples along an image's width and height. Aspect ratio captures the relationship between those dimensions and affects how image geometry is preserved.

  • Image File Formats

    File formats define how image data is encoded and stored. Formats such as JPEG, PNG, and TIFF make different tradeoffs involving compression, quality, metadata, and alpha channels.

  • NumPy Image Arrays

    Computer vision libraries commonly expose images as NumPy arrays. Array shape describes height, width, and channels, while data type and value range determine how pixel measurements are stored and interpreted.

  • Image Coordinates

    Images use a coordinate convention that maps spatial positions to array indices. Correctly distinguishing rows from columns and spatial indices from channel indices prevents common image-processing errors.

  • Image Foundations Synthesis

    This synthesis assessment checks whether learners can reason across the full representation pipeline, from stored image data to the NumPy array used by computer vision code. It emphasizes interpreting dimensions, values, indexing, and encoding choices together.

02Image Processing11 lessons

This module introduces core techniques for transforming images with Python and lightweight vision tools. Learners will load, save, resize, crop, transform, normalize, threshold, smooth, and convolve images while reasoning about how each operation changes image data.

  • Image Loading

    Image loading converts encoded image files into arrays that can be inspected and processed. The lesson focuses on interpreting the loaded representation and identifying changes introduced by the loading process.

  • Image Saving

    Image saving converts an in-memory image array back into an encoded file. The lesson examines how data type, value range, channel order, and file format affect the saved result.

  • Resizing

    Resizing changes an image's spatial dimensions by estimating pixel values at new locations. The lesson focuses on interpolation and the trade-offs between preserving detail, reducing noise, and changing aspect ratio.

  • Cropping

    Cropping selects a spatial subset of an image without estimating new pixel values. The lesson emphasizes coordinate boundaries, array slicing, and the relationship between crop location and output shape.

  • Rotation

    Rotation changes the spatial arrangement of pixels around a chosen center. The lesson examines coordinate transformation, empty regions, and interpolation artifacts created when rotated coordinates do not align with the original pixel grid.

  • Flipping

    Flipping reflects an image across a horizontal or vertical axis by reversing the relevant array dimension. The lesson focuses on the coordinate mapping and the distinction between horizontal and vertical reflections.

  • Intensity Normalization

    Intensity normalization remaps pixel values to a consistent range such as 0–1 or 0–255. The lesson distinguishes range scaling from spatial operations and considers how data type and clipping influence the result.

  • Thresholding

    Thresholding compares pixel intensity with a selected cutoff and assigns an output value based on that comparison. The lesson focuses on how threshold choice affects foreground and background separation.

  • Smoothing

    Smoothing replaces each pixel with a value influenced by nearby pixels, reducing local variation. The lesson examines the relationship between neighborhood size, noise reduction, and loss of fine detail.

  • Convolution

    Convolution applies a small weighted kernel across an image to produce a new value at each location. The lesson focuses on kernel alignment, weighted sums, padding, and how kernel structure determines the type of visual change.

  • Image Processing Synthesis

    This synthesis connects file operations, geometric transformations, intensity transformations, thresholding, smoothing, and convolution. Learners reason about operation order, intermediate representations, and the cumulative effects of preprocessing choices.

03Visual Features9 lessons

This module introduces visual features as measurable patterns in images. Learners will analyze intensity changes, detect edges, corners, and blobs, represent local image neighborhoods with descriptors, reason about feature invariance, and match corresponding features.

  • Image Gradients

    Image gradients quantify the direction and strength of local intensity changes. They provide a foundation for identifying visually meaningful structures such as boundaries and textured regions.

  • Edge Detection

    Edge detection converts local intensity changes into candidate boundaries between regions. Learners examine how thresholds and neighborhood operations affect which edges are retained.

  • Corner Detection

    Corners are localized structures that are distinctive because their neighborhoods vary across more than one direction. Corner detectors score candidate locations based on the amount and orientation of local change.

  • Blob Detection

    Blob detection locates regions with internally consistent appearance and contrast relative to their neighborhoods. The detected regions can vary in size and may be identified using scale-dependent image operations.

  • Keypoints

    Keypoints are image locations chosen because their local neighborhoods contain distinctive structure. Edges, corners, and blobs can provide evidence for selecting keypoints, although not every salient region is equally reliable.

  • Local Descriptors

    A local descriptor represents neighborhood information in a numerical form that can be compared across image locations. Its design determines which local intensity, gradient, or shape patterns are preserved.

  • Feature Invariance

    Feature invariance describes the ability to recognize corresponding visual structures despite specified image transformations. Scale and orientation handling can improve consistency, while excessive invariance may discard useful distinguishing detail.

  • Feature Matching

    Feature matching measures similarity between descriptors and proposes correspondences between keypoints. Match quality depends on descriptor distinctiveness, the distance measure, and methods used to reject ambiguous matches.

  • Visual Features Synthesis

    This synthesis evaluates how local intensity measurements become visual features that can be compared across images. Learners reason about the consequences of detector choices, descriptor representations, transformation changes, and match quality.

04Classical Classification10 lessons

This module introduces classical supervised classification methods for recognizing categories from visual features. Learners will represent images as feature vectors, separate training from evaluation data, scale features, apply nearest-neighbor, tree-based, and margin-based classifiers, and interpret classification results through confusion matrices and cross-validation.

  • Classification

    Classification maps an input representation to a categorical label using patterns learned from labeled examples. The distinction between classes, inputs, and predictions establishes the basic structure of a supervised classification problem.

  • Feature Vectors

    A feature vector is an ordered set of numerical measurements that summarizes an image for machine learning. Its dimensions correspond to selected visual properties, such as descriptor values, color statistics, or texture measurements.

  • Train-Test Splits

    A train-test split assigns one portion of labeled examples to model fitting and withholds another portion for evaluation. Keeping test examples separate helps estimate how the classifier performs on unseen data.

  • Feature Scaling

    Feature scaling transforms measurements so that features with larger numeric ranges do not disproportionately influence a classifier. Common transformations include standardization by mean and standard deviation and rescaling to a bounded interval.

  • K-Nearest Neighbors

    K-nearest neighbors predicts a sample's class from the labels of the closest training examples in feature space. The value of k controls how broadly the method considers neighboring evidence.

  • Decision Trees

    A decision tree recursively divides feature space using rules at internal nodes and assigns a class at a terminal leaf. Each split is selected to make the resulting groups more class-consistent according to a chosen criterion.

  • Support Vector Machines

    A support vector machine seeks a boundary that separates classes while maximizing the margin between the boundary and the nearest training examples. Support vectors are the influential examples that define this boundary.

  • Confusion Matrices

    A confusion matrix counts how often each actual class is assigned to each predicted class. Its diagonal records correct predictions, while off-diagonal entries reveal which classes are being confused.

  • Cross-Validation

    Cross-validation repeatedly divides available training data into fitting and validation portions, then aggregates the resulting scores. This provides a more stable estimate of performance and helps compare model settings without using the final test set.

  • Classical Classification Synthesis

    This synthesis integrates the decisions and reasoning used in a classical classification workflow. Learners compare how feature representation and preprocessing interact with different classifiers and use evaluation structure to judge the reliability of the resulting predictions.

05Convolutional Networks13 lessons

This module introduces convolutional neural networks as models that learn spatially organized visual features directly from images. Learners will reason about receptive fields, weight sharing, learnable filters, feature maps, activation functions, pooling, architecture, training, augmentation, overfitting, and transfer learning.

  • CNN Motivation

    Convolutional neural networks preserve spatial relationships while learning useful visual representations from image data. Their structure reduces the need to manually design feature vectors for classification.

  • Receptive Fields

    A receptive field is the local image region that influences a unit's output. Receptive fields allow early network layers to respond to local patterns while deeper layers combine information from larger regions.

  • Weight Sharing

    A convolutional filter uses the same learned weights as it moves across an image. This reduces the number of parameters and gives the network a degree of translation tolerance.

  • Learnable Filters

    A learnable filter is a set of weights adjusted during training to produce informative responses. Depending on the layer, filters may learn to respond to edges, textures, shapes, or more complex structures.

  • Feature Maps

    A feature map records where a learned filter detects its preferred pattern. A convolutional layer produces multiple feature maps, each representing responses to a different learned pattern.

  • Activation Functions

    An activation function transforms layer outputs before they are passed onward. Nonlinear activations allow stacked layers to represent complex relationships that a sequence of linear operations could not capture.

  • Pooling

    Pooling replaces a local neighborhood with a summary such as its maximum or average value. It reduces spatial computation and can make representations less sensitive to small positional changes.

  • CNN Architecture

    A CNN architecture specifies how layers are arranged to transform pixels into class scores. Early layers typically preserve local spatial information, while later layers combine responses into increasingly abstract representations.

  • CNN Training

    During training, a CNN produces predictions, compares them with target labels through a loss, and uses gradients to update its filters and other parameters. Repeated updates make the learned representation more useful for the classification task.

  • Data Augmentation

    Data augmentation applies transformations such as flips, crops, or small rotations that preserve the intended class. These altered examples encourage a network to learn robust visual patterns rather than memorize exact training images.

  • Overfitting

    Overfitting occurs when a CNN models training examples or noise too specifically and performs worse on unseen data. Diverging training and validation performance provides evidence that learned representations are not generalizing well.

  • Transfer Learning

    Transfer learning starts with parameters learned from a large image dataset and adapts them to a different task. Earlier layers often provide broadly useful visual features, while later layers may require greater adaptation.

  • Convolutional Networks Synthesis

    This synthesis evaluates whether learners can explain how a CNN transforms image pixels into class predictions and how design and training choices affect its learned representation and generalization. It requires reasoning across the full sequence of concepts introduced in the module.

06Evaluation and Synthesis11 lessons

This module develops a disciplined approach to evaluating computer vision models. Learners will distinguish validation from test data, detect data leakage, interpret complementary performance metrics, account for class imbalance, choose decision thresholds, analyze errors, and compare models using evidence from a consistent evaluation protocol.

  • Validation Sets

    A validation set provides performance feedback during model development while keeping the test set reserved for final evaluation. Learners will distinguish the roles of training, validation, and test data.

  • Data Leakage

    Data leakage occurs when information from validation or test examples, or from the target label, improperly influences training. Learners will recognize leakage pathways and reason about why they invalidate performance estimates.

  • Accuracy

    Accuracy summarizes the fraction of predictions that match the true class. Learners will connect the metric to correct and incorrect predictions and recognize when it provides a useful overall summary.

  • Precision

    Precision measures the reliability of positive predictions. Learners will reason about how false positives affect precision and when a model's positive predictions need to be trustworthy.

  • Recall

    Recall measures how completely a model detects the positive examples that are present. Learners will reason about the effect of false negatives on recall.

  • F1 Score

    The F1 score summarizes the balance between precision and recall, penalizing cases where one is much lower than the other. Learners will calculate and interpret F1 values in relation to its component metrics.

  • Class Imbalance

    Class imbalance occurs when some categories have substantially more examples than others. Learners will analyze why a model can achieve high accuracy while performing poorly on a minority class.

  • Threshold Selection

    A model's score threshold determines which predictions are assigned to a class. Learners will reason about how threshold changes affect precision, recall, and the resulting decision behavior.

  • Error Analysis

    Error analysis examines misclassified examples rather than relying only on summary metrics. Learners will categorize errors by visual characteristics, class confusion, or data conditions to interpret what a model has not learned reliably.

  • Model Comparison

    A meaningful model comparison controls the evaluation conditions while considering performance across relevant metrics. Learners will distinguish evidence-based comparisons from conclusions drawn from inconsistent or incomplete measurements.

  • Evaluation and Synthesis

    This synthesis requires learners to interpret an evaluation protocol from data separation through model comparison. They will connect metric evidence and qualitative error patterns to determine how confidently a model generalizes and where its limitations remain.

Questions

Do I need prior computer vision experience?

No. The course starts with pixels, channels, color spaces, image resolution, and NumPy image arrays before moving into processing, features, classification, CNNs, and evaluation.

Which tools and libraries are covered?

The course uses Python with lightweight computer-vision and machine-learning tools such as OpenCV, NumPy, and torchvision. The emphasis is on understanding what the operations and models do, not on memorizing library calls.

Will I learn both traditional computer vision and deep learning?

Yes. You will study gradients, edges, keypoints, descriptors, and classical classifiers before learning CNN concepts such as receptive fields, weight sharing, feature maps, pooling, training, augmentation, overfitting, and transfer learning.

How much mathematics is required?

You should be comfortable with basic numerical reasoning, averages, distances, and interpreting tables and graphs. The course explains the computer-vision mathematics needed for convolution, classification, and evaluation without assuming advanced mathematics.

How will I know whether a vision model is performing well?

You will go beyond accuracy by using validation and test sets correctly, checking for data leakage, interpreting confusion matrices, comparing precision, recall, and F1 score, accounting for class imbalance, selecting thresholds, and analyzing individual errors.

The first lesson is ten minutes away.

Free while codeset is early. You choose what you're building before the first lesson starts, and the course is taught around it.

Start this course

Other courses