Intro to Image Processing with MATLAB

Duncan Carlsmith, University of Wisconsin-Madison, Physics
Author Profile

Summary

This short project introduces students to image processing with MATLAB including importing images from the web, color transformations, circle finding, and edge finding. These techniques are broadly applicable in image data analysis.

Used this activity? Share your experiences and modifications

Learning Goals

Import an image from the web into MATLAB using the image URL.
Be aware of MATLAB supported image formats.
Use the 'type' command to read code that implements available functions.
Extract and understand image provenance information (EXIF data).
Show and export images.
Crop images.
Create a montage.
Histogram data in three channels of an RGB image.
Access image data by value.
Segment image using 'findcircles.'
Convert color images to greyscale.
Find edges in a greyscale image using 'edge.'
Transform from one color space to another.
Practice creating a Live Script.

Context for Use

This exercise is deployed in the first or second week after an introduction to MATLAB as an online at home project following a basic introduction to MATLAB syntax and data structures. Students begin to appreciate images as data and the capabilities of MATLAB and acquire immediately useful skills that are applied to laboratory data they will be collecting with their mobile phone cameras. The exercise also requires students write a first Live Script. This project could be used in any introductory class using MATLAB for science.

Description and Teaching Materials

Image processing is an important skill in most scientific fields including physics. The supplied hyperlinked CANVAS quiz and Live Script serves to introduce basic image processing. Success is measured directly by the student's product - a segmented image of their choice.
Image processing quiz (Acrobat (PDF) 452kB Sep11 20)
Image processing Live Script (pdf) (Acrobat (PDF) 14.8MB Sep11 20)
Image processing Live Script (mlx) (MATLAB Live Script 5.8MB Sep11 20)

Teaching Notes and Tips

The user will find extensive comments embedded in the Live Script concerning MATLAB functions. It should be emphasized that students need to adjust the circle radius range to be appropriate to their image in using findcircles, and that findcircles is not designed to find point sources like stars.

Assessment

Assessment is based on a student submission of a segmented image with found circles displayed. It is not important that all circular objects be found.

References and Resources

Please see hyperlinks in the introductory quiz and in the Live script.