imageprocessing¶
Joshua Stough, 202- (last update Spring 2026)¶
Read it online: profstough
Imaging is everywhere! In this text, we will cover broadly the acquisition, processing, and analysis of digital images, covering topics ranging from the human visual system, to image and video compression algorithms, to pattern recognition and machine learning within the context of automatic image understanding. Best of all, for the sake of access, immediacy, and usability, all content and code examples are in the form of interactive Jupyterlab notebooks, including integrated activities!
Written with extensive assistance of Claude in drafting narrative and copyediting, and backend book production, based on the draft notebook collection at joshuastough
A note on AI¶
With the advent of IDE-integrated LLM copilots, any of the integrated activities or playpen notebooks are trivial to complete. That is, your completion of them reflect almost nothing about your understanding of the material. If you’re in class using this textbook resource, you can be expected to have to explain your work in non-augmented coding interviews throughout the course, which will comprise much of your grade. These integrated activities are to help guide your learning, not add to your instructor’s menial labor.
Compute Environment¶
This text is tested on several platforms, but principally Visual Studio Code linked to a locally-run Python virtual environment managed by uv.
Please create a private fork of this project, rather than publicly hosting your modified notebooks (with all of their solved activities).
Install a local virtual environment supporting this textbook
From the root of your clone, create the environment (this reads pyproject.toml and the pinned
uv.lock):
$ uv syncIn VS Code, open any notebook and select the
.venvPython kernel. Or, from the terminal,uv run jupyter lab.
PyTorch is installed from the CUDA 12.6 wheel index. Notebooks that use it will fall back to the CPU if you don’t have a CUDA-capable card. (A legacy conda environment, env_dip26.yml, is still included for those who prefer it: conda env create -f env_dip26.yml.)
Datasets¶
A few chapters (PCA, Neural Nets) use datasets too large to keep in the repository. All of them live under one data root, ~/data by default. To use a different location, set the DIP_DATA environment variable before launching Jupyter.
| Dataset | Used in | How to get it |
|---|---|---|
| MNIST | NeuralNets/mnist_*, PCA/pca_mnist | Downloaded automatically by torchvision the first time |
| ORL (AT&T) faces | PCA/pca_*Faces | AT&T Database of Faces; unpack to $DIP_DATA/ORL/ (40 subject folders) |
| Cropped Yale B | NeuralNets/yale_* | Extended Yale B, “Cropped Images”; unpack to $DIP_DATA/CroppedYale/ |
| Extended Yale B (full) | NeuralNets/yale_explore (last section only) | Same page; unpack to $DIP_DATA/ExtendedYaleB/ |
No dataset? You can still read those notebooks: after each of their key cells, an Expected output dropdown shows what the cell produces when run with the data.
If a dataset is missing, the notebook stops with a message that says where to download it and where to put it (see dip
Opening in Colab¶
Alternatively you can work with this textbook in the cloud, through Google Colab, with no local install and with a free GPU for the neural network chapters. The notebooks rely on the book’s other folders (dip_utils/, dip_pics/), so a notebook opened in Colab by itself won’t run. Instead, open the setup notebook below and run it: it copies the book (or your private fork) into your Google Drive, where your work is kept between sessions, and gives you a short setup cell to paste at the top of each notebook you open.