Image Segmentation Tutorial

Image Processing Tutorial to demonstrate the basic concepts to beginner users.
105.7K Downloads
Updated 14 Mar 2022

View License

Editor's Note: Popular File 2013 2015 2018 2019 2020

This file was selected as MATLAB Central Pick of the Week

Perfect for the beginner, this demo illustrates simple object detection (segmentation, feature extraction), measurement of various characteristics (area, etc.), and filtering (extracting only certain objects).
First it finds all the objects (coins), then filters results to pick out objects of certain diameters. The basic concepts of thresholding, labeling, and regionprops are demonstrated with a simple example.
It's a good tutorial for those users new to MATLAB's image processing capabilities to learn on, before they go on to more sophisticated algorithms.
Requires the Image Processing Toolbox because it demonstrates some functions supplied by that toolbox, plus it uses the "coins" demo image supplied with that toolbox.
Tested with R2008b through R2022a.

Cite As

Image Analyst (2024). Image Segmentation Tutorial (https://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with R2008b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.7.0.0

Better comments. Now blobs are labeled with the label number. Made sure it runs with r2022a.

1.6.0.0

Updated for R2015a.

1.5.0.0

Renamed main title and altered description slightly.

1.4.0.0

Spelling correction in the description.

1.3.0.0

Updated description and made change to how labeled image is displayed.

1.1.0.0

Added label numbers to each blob. Extracted each blob to a separate image.

1.0.0.0