Project 3: Image Processing and Edge Detection

Build a mini image lab that smooths images and extracts edges.


Project Overview

Attribute Value
Difficulty Level 1: Beginner
Time Estimate Weekend
Main Language MATLAB
Alternative Languages Python (OpenCV), Octave
Knowledge Area Image processing
Tools MATLAB Image Processing Toolbox (optional)
Main Book “Digital Image Processing” by Gonzalez & Woods

What you’ll build: A script that loads an image, applies blur and sharpening, and runs edge detection.

Why it teaches MATLAB: Images are matrices. Filtering them shows how convolution works in practice.

Core challenges you’ll face:

  • Applying convolution kernels
  • Handling grayscale vs color images
  • Visualizing intermediate steps

Real World Outcome

You will generate processed images showing smoothed, sharpened, and edge-detected results.

Example Output:

>> image_lab('photo.jpg')
Saved outputs: blur.png, sharpen.png, edges.png

Verification steps:

  • Compare original vs filtered images
  • Confirm edges align with high-contrast boundaries

The Core Question You’re Answering

“How do simple filters reveal structure in images?”

This is the foundation of computer vision.


Concepts You Must Understand First

Stop and research these before coding:

  1. Convolution
    • How does a kernel modify a pixel neighborhood?
    • Book Reference: “Digital Image Processing” by Gonzalez & Woods, Ch. 3
  2. Smoothing vs sharpening
    • Why does blur remove noise but reduce detail?
    • Book Reference: “Digital Image Processing” by Gonzalez & Woods, Ch. 3
  3. Edge detection
    • How do gradient filters detect edges?
    • Book Reference: “Digital Image Processing” by Gonzalez & Woods, Ch. 10

Questions to Guide Your Design

  1. Kernel choice
    • Will you implement Gaussian blur or a simple box filter?
    • Which edge detector will you use (Sobel, Prewitt)?
  2. Output comparison
    • How will you display side-by-side images?
    • Will you normalize image values for display?

Thinking Exercise

Simple Kernel

Apply a 3x3 averaging kernel to a 3x3 pixel patch with a single bright center pixel. Predict the output.

Questions while working:

  • Why does the bright spot fade?
  • How does kernel size affect blur strength?

The Interview Questions They’ll Ask

Prepare to answer these:

  1. “What is convolution in image processing?”
  2. “Why does blurring reduce noise?”
  3. “How does a Sobel filter detect edges?”
  4. “What happens to edges if you over-smooth?”
  5. “Why do we normalize filter outputs?”

Hints in Layers

Hint 1: Starting Point Start with grayscale images to simplify processing.

Hint 2: Next Level Apply a blur kernel and verify the effect.

Hint 3: Technical Details Use padding to handle borders consistently.

Hint 4: Tools/Debugging Display intermediate outputs to validate each step.


Books That Will Help

Topic Book Chapter
Convolution “Digital Image Processing” by Gonzalez & Woods Ch. 3
Filtering “Digital Image Processing” by Gonzalez & Woods Ch. 3
Edge detection “Digital Image Processing” by Gonzalez & Woods Ch. 10

Implementation Hints

  • Normalize image values after filtering.
  • Keep kernels in separate functions for reuse.
  • Save outputs with clear filenames.

Learning Milestones

  1. First milestone: You can blur and sharpen images.
  2. Second milestone: You can detect edges reliably.
  3. Final milestone: You can explain how kernels shape results.