(1) | Select the random cluster centers. Let the number of cluster centers be “*C*.” |

(2) | Calculate the Euclidean distance. |

(3) | Take each and every pixel and assign them into the appropriate cluster if the Euclidean distance is minimum between the cluster and pixel. |

(4) | Once the segregation is completed for all the pixels, recalculate the new cluster center using the median value instead of using a squared formula. |

(5) | Repeat the steps from 2 to 4 for some number of iterations or until a certain condition is encountered. |