Column Sorting Technique In 2D MATLAB – M. Ganesh Sai

Column sort is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted through the columns in the matrix  swapping each column if they are in the wrong order. The pass through the matrix is repeated until no swaps are needed, which indicates that the matrix is sorted. The algorithm gets its name from the way that the each column is sorted in the matrix.

 

Illustrative Example

           Let us take the matrix form , and sort the each column step by step from lowest number to greatest number using row sort. In each step, elements written in bold are being sorted. Five steps will be required.

                                                        

                                                         95       45       92       41       13

                                                        73       89       20       74       52

                                                        05       19     44       20       73

                                                        40       35     60       93       67

                                                        81       27     46       83       93

First step:

First sort the column 1 elements in the matrix form.

95     45     92   41     13                                                       05   45   92   41   13

73     89     20   74     52                                                       40   89   20   74   52

05     19     44   20     73                           →                        73   19   44   20   73

40     35     60   93     67                                                       81   35   60   93   67

81     27   46   83     93                                                         95     27   46   83   93

Second step:

Sort the column 2 elements in the matrix form.

95     45     92   41     13                                                       95   19   92   41   13

73     89     20   74     52                                                       73   27   20   74  52

05     19     44   20     73                           →                        05   35   44   20   73

40     35     60   93     67                                                       40   45   60   93   67

81     27   46   83     93                                                         81     89   46   83   93

Third step:

Sort the column 3 elements in the matrix form.

95     45     92   41     13                                                      95   45   20   41   13

73     89     20   74     52                                                      73   89   44   74   52

05     19     44   20     73                           →                        05   19   46   20   73

40     35     60   93     67                                                      40   35   60   93   67

81     27   46   83     93                                                        81     27   92    83   93

Fourth step:

Sort the column 4 elements in the matrix form.

95     45     92   41     13                                                       95   45   92   20   13

73     89     20   74     52                                                       73   89   20   41   52

05     19     44   20     73                           →                         05   19   44   74   73

40     35     60   93     67                                                        40   35   60   83   67

81     27   46   83     93                                                          81     27   46   93   93

 

Fifth step:

Sort the column 5 elements in the matrix form.

95     45     92   41     13                                                       95   45   92   41   13

73     89     20   74     52                                                      73   89   20   74   52

05     19     44   20     73                           →                       05   19   44   20   67

40     35     60   93     67                                                     40   35   60   93   73

81     27   46   83     93                                                       81     27   46   83   93

 

Finally sorted columns in the matrix is shown below:  

95     45     92   41     13                                                       05   19   20   20   13

73     89     20   74     52                                                       40   27   44   41   52

05     19     44   20     73                           →                        73   35   46   74   67

40     35     60   93     67                                                       81   45   60   83   73

81     27   46   83     93                                                         95   89   92   93   93

Column Sort Output Table are given bellow:

Selection

        3X3

 

        5X5

 

        7X7

 

         9X9

 

Noise Density

psnr

Time

Psnr

Time

psnr

time

psnr

time

10%

32.05

3.15

32.02

3.35

32.34

3.32

31.98

3.42

20%

28.40

3.18

28.52

3.12

28.10

3.21

28.38

3.13

30%

25.99

3.05

26.17

3.01

26.17

3.19

25.92

3.11

40%

23.83

2.95

24.08

2.93

24.06

2.99

23.98

3.06

50%

22.14

2.79

22.03

2.97

22.20

2.88

22.12

2.93

60%

20.41

2.67

20.58

2.74

20.36

2.80

20.29

2.72

70%

18.65

2.54

18.54

2.54

18.71

2.62

18.58

2.62

80%

16.58

2.41

16.71

2.40

16.78

2.52

16.76

2.49

90%

13.94

2.33

14.05

2.49

14.24

2.54

13.98

2.36

//

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s