Create Segmentation_Seq.c

Main Algorithm
Given an image I with N pixels,main algorithm consists of these steps
Step 1
Transform the image into weighted graph
Construct N * N symmetric weights matrix as:
w(vi,vj) = | grayLevel ( vj ) - grayLevel ( vj ) |
between each pixel & its 8-neighbors but because the matrix is symmetric, the size can be reduce to the
half which means that the weights matrix size will be only N * 4 ; the pixel & its next 4- neighbors.
Step 2
Segmentation
Apply Kruskal algorithm to transform graph to min spanning tree. Next is pseudo-code of the
algorithm:
1. Sort(weighted edges)
2. Construct a Regions with size= N & initiate it as each pixel is in separate region
Region [ Vn ] = Vn
3. For each sorted edge do:
1. Define the end points(vertexes)
2. Find the region that containing each vertex
3. If they are in different regions, union them in one region
4. Go to 3
Step 3
Construct Segmented Images
For each region which size greater than givens threshold build an image I` with the same size as the
original image I & draw only the pixels in that region.