| 1 |
medians |
| 2 |
|
| 3 |
This plugin implements several median-type filters |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
Written by Marko Cebokli, jan 2013, and released under GNU GPL |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
RELEASE NOTES |
| 12 |
|
| 13 |
** feb 2013 |
| 14 |
Version 0.1 |
| 15 |
"pre-alpha" (throw it out and see what happens... :-) |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
INTRODUCTION |
| 20 |
|
| 21 |
Median is a quite popular non-linear filter in image processing. |
| 22 |
Most often it is used to remove impulsive noise, like |
| 23 |
"salt & pepper" noise, "dead" and "hot" pixels, dirt on film, etc. |
| 24 |
This is because it behaves kind of "inversely" compared to |
| 25 |
linear denoisers. The more a bad pixel stands out from the |
| 26 |
surrounding area, the bigger residual it will leave with a linear |
| 27 |
filter - but the more probably it will be eliminated by the median. |
| 28 |
|
| 29 |
The down side is that the median operation is quite slow. As an |
| 30 |
order-statistic filter, it is similar to sorting, that must be |
| 31 |
done for each pixel. |
| 32 |
So, I searched the web for fast median algorithms. For the small |
| 33 |
medians, I use [1], with some small modifications for a further |
| 34 |
slight improvement in speed. |
| 35 |
For the "Variable size" median I use [2]. |
| 36 |
I have implemented the compound filters (ArceBI, ML3D, ML3dEX) |
| 37 |
according to the formulas given in [3]. |
| 38 |
For more info on median filtering see |
| 39 |
http://en.wikipedia.org/wiki/Median_filter |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
IMPLEMENTED ALGORITHMS |
| 44 |
|
| 45 |
Cross5: |
| 46 |
Median of the pixel with its top, bottom, left and right neighbor. |
| 47 |
|
| 48 |
Square3x3: |
| 49 |
Median of the pixel with the surrounding 8 pixels. (3x3 box) |
| 50 |
|
| 51 |
Bilevel: |
| 52 |
First, make cross5 median, then make median of the pixel with its |
| 53 |
four diagonal neighbors, and finally take the median of the pixel |
| 54 |
and the two previously calculated medians. |
| 55 |
Slightly better preserves detail than the simple medians above. |
| 56 |
|
| 57 |
Diamond3x3: |
| 58 |
Takes median of the pixel with 12 neighboring pixels arranged in a |
| 59 |
diamond pattern. |
| 60 |
|
| 61 |
Square5x5: |
| 62 |
Median of the pixel with the 5x5 surrounding box. |
| 63 |
|
| 64 |
Temp3: |
| 65 |
Temporal only median of three frames. Can be used to reduce |
| 66 |
single frame time-impulsive noise like photoflash. |
| 67 |
Delays the video by 1 frame. |
| 68 |
|
| 69 |
Temp5: |
| 70 |
Temporal only median of five frames. Can be used to reduce |
| 71 |
double frame time-impulsive noise, but the artifacts on fast moving |
| 72 |
objects are stronger than with temp3. |
| 73 |
Delays the video by 2 frames. |
| 74 |
|
| 75 |
ArceBI: |
| 76 |
Spatio-temporal multilevel median, as described by Arce. See [3]. |
| 77 |
Delays the video by 1 frame. |
| 78 |
|
| 79 |
ML3D: |
| 80 |
Spatio-temporal multilevel median, as described by Alp. See [3]. |
| 81 |
Delays the video by 1 frame. |
| 82 |
|
| 83 |
ML3dEX: |
| 84 |
Spatio-temporal multilevel median. Further development of ML3D |
| 85 |
by Kokaram, see [3]. |
| 86 |
Delays the video by 1 frame. |
| 87 |
|
| 88 |
VarSize: |
| 89 |
Simple spatial only median in a user selected size square box |
| 90 |
around each pixel. |
| 91 |
The effect could be described as "quasi edge preserving, corner |
| 92 |
rounding, small stuff eliminator". |
| 93 |
Or maybe just an "artsy blur". |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
PARAMETERS: |
| 98 |
|
| 99 |
Type: |
| 100 |
selects one of the eleven algorithms |
| 101 |
|
| 102 |
Size: |
| 103 |
Only active when "VarSize" type is selected. Determines the |
| 104 |
size of the square area over which the median is taken. |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
REFERENCES |
| 109 |
|
| 110 |
[1] http://ndevilla.free.fr/median/median/src/optmed.c |
| 111 |
|
| 112 |
[2] Simon Perreault, Patrick Hebert: Median filtering in |
| 113 |
constant time |
| 114 |
http://nomis80.org/ctmf.pdf |
| 115 |
http://nomis80.org/ctmf.html |
| 116 |
|
| 117 |
[3] Anil Christopher Kokaram: Motion Picture Restoration |
| 118 |
phd dissertation |