home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_docs.lzh / NETPBM / DOCS / pnmnlfilt.1 < prev    next >
Text File  |  1996-11-18  |  6KB  |  113 lines

  1. .TH pnmnlfilt 1 "5 February 1993"
  2. .IX pnmnlfilt
  3. .SH NAME
  4. pnmnlfilt - non-linear filters: smooth, alpha trim mean, optimal
  5. estimation smoothing, edge enhancement.
  6. .SH SYNOPSIS
  7. .B pnmnlfilt
  8. .RI alpha
  9. .RI radius
  10. .RI [ pnmfile ]
  11. .SH DESCRIPTION
  12. .IX smoothing
  13. .IX dithering
  14. .IX alpha trim
  15. .IX mean filter
  16. .IX median filter
  17. .IX optimal estimation
  18. This is something of a swiss army knife filter. It has 3 distinct operating
  19. modes. In all of the modes each pixel in the image is examined and processed
  20. according to it and its surrounding pixels values. Rather than using the
  21. 9 pixels in a 3x3 block, 7 hexagonal area samples are taken, the size of
  22. the hexagons being controlled by the radius parameter. A radius value of
  23. 0.3333 means that the 7 hexagons exactly fit into the center pixel (ie.
  24. there will be no filtering effect). A radius value of 1.0 means that
  25. the 7 hexagons exactly fit a 3x3 pixel array.
  26. .SH Alpha trimmed mean filter.    (0.0 <= alpha <= 0.5)
  27. .PP
  28. The value of the center pixel will be
  29. replaced by the mean of the 7 hexagon values, but the 7 values are
  30. sorted by size and the top and bottom alpha portion of the 7 are
  31. excluded from the mean.  This implies that an alpha value of 0.0 gives
  32. the same sort of output as a normal convolution (ie. averaging or
  33. smoothing filter), where radius will determine the "strength" of the
  34. filter. A good value to start from for subtle filtering is alpha = 0.0, radius = 0.55
  35. For a more blatant effect, try alpha 0.0 and radius 1.0
  36. .PP
  37. An alpha value of 0.5 will cause the median value of the
  38. 7 hexagons to be used to replace the center pixel value. This sort
  39. of filter is good for eliminating "pop" or single pixel noise from
  40. an image without spreading the noise out or smudging features on
  41. the image. Judicious use of the radius parameter will fine tune the
  42. filtering. Intermediate values of alpha give effects somewhere
  43. between smoothing and "pop" noise reduction. For subtle filtering
  44. try starting with values of alpha = 0.4, radius = 0.6  For a more blatant
  45. effect try alpha = 0.5, radius = 1.0
  46. .SH Optimal estimation smoothing. (1.0 <= alpha <= 2.0)
  47. .PP
  48. This type of filter applies a smoothing filter adaptively over the image.
  49. For each pixel the variance of the surrounding hexagon values is calculated,
  50. and the amount of smoothing is made inversely proportional to it. The idea
  51. is that if the variance is small then it is due to noise in the image, while
  52. if the variance is large, it is because of "wanted" image features. As usual
  53. the radius parameter controls the effective radius, but it probably advisable to
  54. leave the radius between 0.8 and 1.0 for the variance calculation to be meaningful.
  55. The alpha parameter sets the noise threshold, over which less smoothing will be done.
  56. This means that small values of alpha will give the most subtle filtering effect,
  57. while large values will tend to smooth all parts of the image. You could start
  58. with values like alpha = 1.2, radius = 1.0 and try increasing or decreasing the
  59. alpha parameter to get the desired effect. This type of filter is best for
  60. filtering out dithering noise in both bitmap and color images.
  61. .SH Edge enhancement. (-0.1 >= alpha >= -0.9)
  62. .PP
  63. This is the opposite type of filter to the smoothing filter. It enhances
  64. edges. The alpha parameter controls the amount of edge enhancement, from
  65. subtle (-0.1) to blatant (-0.9). The radius parameter controls the effective
  66. radius as usual, but useful values are between 0.5 and 0.9. Try starting
  67. with values of alpha = 0.3, radius = 0.8
  68. .SH Combination use.
  69. .PP
  70. The various modes of 
  71. .B pnmnlfilt
  72. can be used one after the other to get the desired result. For instance to
  73. turn a monochrome dithered image into a grayscale image you could try
  74. one or two passes of the smoothing filter, followed by a pass of the optimal estimation
  75. filter, then some subtle edge enhancement. Note that using edge enhancement is
  76. only likely to be useful after one of the non-linear filters (alpha trimmed mean
  77. or optimal estimation filter), as edge enhancement is the direct opposite of
  78. smoothing.
  79. .PP
  80. For reducing color quantization noise in images (ie. turning .gif files back into
  81. 24 bit files) you could try a pass of the optimal estimation filter
  82. (alpha 1.2, radius 1.0), a pass of the median filter (alpha 0.5, radius 0.55),
  83. and possibly a pass of the edge enhancement filter.
  84. Several passes of the optimal estimation filter with declining alpha
  85. values are more effective than a single pass with a large alpha value.
  86. As usual, there is a tradeoff between filtering effectiveness and loosing
  87. detail. Experimentation is encouraged.
  88. .SH References:
  89. .PP
  90. The alpha-trimmed mean filter is 
  91. based on the description in IEEE CG&A May 1990 
  92. Page 23 by Mark E. Lee and Richard A. Redner,
  93. and has been enhanced to allow continuous alpha adjustment.
  94. .PP
  95. The optimal estimation filter is taken from an article "Converting Dithered
  96. Images Back to Gray Scale" by Allen Stenger, Dr Dobb's Journal, November
  97. 1992, and this article references "Digital Image Enhancement and Noise Filtering by
  98. Use of Local Statistics", Jong-Sen Lee, IEEE Transactions on Pattern Analysis and
  99. Machine Intelligence, March 1980.
  100. .PP
  101. The edge enhancement details are from pgmenhance(1),
  102. which is taken from Philip R. Thompson's "xim"
  103. program, which in turn took it from section 6 of "Digital Halftones by
  104. Dot Diffusion", D. E. Knuth, ACM Transaction on Graphics Vol. 6, No. 4,
  105. October 1987, which in turn got it from two 1976 papers by J. F. Jarvis
  106. et. al.
  107. .SH "SEE ALSO"
  108. pgmenhance(1), pnmconvol(1), pnm(5)
  109. .SH BUGS
  110. Integers and tables may overflow if PPM_MAXMAXVAL is greater than 255.
  111. .SH AUTHOR
  112. Graeme W. Gill    graeme@labtam.oz.au
  113.