Intro to Image Processing with MATLAB
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.
Live Scripts touching physics, astronomy, engineering, mathematics, biology, computation, and use of AI's are freely available at the MathWorks File Exchange. The link https://www.mathworks.com/matlabcentral/fileexchange/?q=carlsmith&sort=date_desc_submitted provides a list of currently available Live Scripts each with a brief description. Click the Live Script name to open the File Exchange page for that script. Use the examples tab to preview the Live Script. Use the 'Download' button to download a zip file containing the executable script, a PDF of the executed script, and possible associated functions, data, and media files. Use the 'Open in MATLAB Online' button to open the package in your MATLAB cloud account. The cloud option offers in a browser window a version of the native IDE supporting editing, coding assistance, debugging, script execution, and help.
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 grayscale 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 to 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 serve 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 when 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 unimportant that all circular objects be found.
References and Resources
Please see the hyperlinks in the introductory quiz and in the Live script.