0% found this document useful (0 votes)
10 views2 pages

LAB#7

The lab focuses on image segmentation using clustering techniques, specifically K-means clustering and region growing. K-means clustering involves grouping pixels based on similarity, while region growing expands a region from a seed point based on intensity values. The lab tasks include implementing these techniques on an image and displaying the results.

Uploaded by

saqlainkharal39
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

LAB#7

The lab focuses on image segmentation using clustering techniques, specifically K-means clustering and region growing. K-means clustering involves grouping pixels based on similarity, while region growing expands a region from a seed point based on intensity values. The lab tasks include implementing these techniques on an image and displaying the results.

Uploaded by

saqlainkharal39
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB-07: Segmentation

Objective:

The objective of this lab is to apply perform segmentation on images using different using clustering
and perform region growing.

Theory:

Segmentation of an image can be achieved by clustering: a technique that groups together the
pixels in an image using some measure of similarity. K means clustering is the most basic and
widely used clustering technique for data grouping, in machine learning and in colored image
segmentation. The algorithm for K-means clustering is as following

1. Chose the number (K) of clusters and randomly select the centroids of each cluster.
2. For each data point:
 Calculate the distance from the data point to each cluster.
 Assign the data point to the closest cluster.
3. Recompute the centroid of each cluster.
4. Repeat steps 2 and 3 until there is no further change in the assignment of data points (or in the
centroids).

The above image has been segmented using the labels “yellow”, “red” and “blue”. For a grayscale
image, these will be intensity values in grayscale.

Region Growing is also another kind of region-based segmentation method. For region growing, a
“seed” point is selected. Whenever this seed is encountered in an image, its surrounding
neighboring pixels are checked and a decision is made whether a neighboring pixel should be
added to the region or not following a selection criterion. One criterion that can be used is that
only that pixel is kept from the neighbors that has the same intensity value as the pixel itself.

Several complete passes of the image are needed in order for region growing to completely work.

Some Useful Commands:

No new commands are needed for this lab.

Lab Tasks:

Lab Task 1:
Write a function that takes an image (Fig01.tif) and a set of values (64,128,196) as input and
segments the images based on those values using K-mean clustering. Display the resulting image.

Lab Task 2:
Write a function that takes an image (Fig01.tif) and a seed point as input and applies region
growing on it. The selection criterion is to keep that pixel that has the same value as the seed
point. Display the resultant image.

Conclusion:

This lab has given an introduction to segmentation and has implemented two different techniques of
achieving it.

You might also like