Image Segmentation Tutorial

Image Processing Tutorial to demonstrate the basic concepts to beginner users.
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 (, 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

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

Updated for R2015a.

Renamed main title and altered description slightly.

Spelling correction in the description.

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

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