Counting Sort(U-Sort) Algorithm in MATLAB

Step 1) A 2-D window “Sxy ” of size 3*3 is selected. Assume the pixel to be processed is P(X, Y).

Step 2) The pixel values inside the window are sorted, and Pmin, Pmax, and Pmed are determined as follows.

  1. The entire matrix of an window is are arranged in ascending order with the u-sort.
  2. The total elements are been considered in Pmin, Pmax, and Pmed with U-sort.

Step 3)

   Case 1) The P(X,Y) is an uncorrupted pixel if Pmin<P(X,Y)<Pmax,Pmin>0, and Pmax<255; the pixel being processed is left unchanged. Otherwise, P(X,Y) is a corrupted pixel.

   Case 2) If P(X,Y) is a corrupted pixel, it is replaced by its median value if and .

   Case 3) If is not satisfied or , then is a noisy pixel. In this case, the P(X,Y) is replaced by the value of neighborhood pixel value.

Step 4) Steps 1 to 3 are repeated until the processing is completed for the entire image.

Step 5) Here we count the number of times that each number repeats in the given input value.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s