Stage 1: Initialize the class centers Ci (i = 1, ・・・, c). This is carried out by selecting randomly c points in the gray level scale [0…255].

For each iteration i:

Stage 2: Determine the membership matrix using Equation (2).

Stage 3: Compute the cost function J by Equation (1).

Stage 4: Compare the obtained cost function J to the one computed at iteration i − 1 and stop the loop (i.e. go to stage 6) if the absolute value of the difference between the successive cost functions is lower than an arbitrary defined threshold (Eth).

Stage 5: Calculate the new class centers by Equation (6), and return back to perform stages 2, 3 and 4.

Stage 6: End.