% verify_environment.m
assert(verLessThan('matlab', '9.8') == 0, 'Need R2020a or newer');
assert(license('test', 'image_toolbox'), 'Image Toolbox missing');
fprintf('Environment verified for DIP 3e code.\n');
Unlike earlier editions where code was distributed via CD-ROM or static zip files, the authors (specifically Dr. Steven Eddins) maintain the official code on GitHub.
The real power of verified GitHub repositories is that they serve as a foundation for your own projects. Once you have a verified base, you can:
Verified repos are maintained. Check the commits page. If the last commit was in 2017 (before the 3rd edition was released in 2018), do not use it. % verify_environment
Book reference: Section 4.4.2 – Ideal Lowpass Filter
Verified snippet:
f = imread('moon.tif');
f = im2double(f);
% Fourier transform and shift
F = fft2(f);
Fc = fftshift(F);
% Create ideal lowpass filter (radius 30)
[M, N] = size(f);
u = 0:(M-1); v = 0:(N-1);
[U, V] = meshgrid(u, v);
D = sqrt((U - M/2).^2 + (V - N/2).^2);
radius = 30;
H = double(D <= radius);
% Apply filter
G = H .* Fc;
g = real(ifft2(ifftshift(G)));
imshow(g);
Verification note: Verified repos use meshgrid correctly (some use ndgrid incorrectly). The 3rd edition specifically uses meshgrid to preserve coordinate alignment.
Before diving into GitHub code, let’s clarify why this specific edition matters. The 3rd edition modernizes the classic content by: Unlike earlier editions where code was distributed via
Unlike the 1st or 2nd editions, the 3rd edition emphasizes practical verification—meaning every example is meant to be run, not just read.