Author Topic: Median/Dust and Scratches Node?  (Read 3318 times)

Would anyone have an idea on how to implement a filter similar to Median or Dust and Scratches in Photoshop? I'm trying to *reduce* noise but maintain edges.

Wiki on Median Filter:

Check out my Substance Blog!

It's feasible to do a 3x3 median filter, although the result is probably going to be slow compared to Photoshop's filter. The basic idea is to use an FxMap that draws square patterns the size of a pixel. The color of each pattern should be decided by a function graph which reads all colors in the 3x3 neighbourhood and computes the median. You can read pixel values from an FxMap input in a function graph using the Sample node.
In theory, you could do a median filter of any fixed size (5x5, 7x7, etc.) but anything larger than 3x3 is going to be tedious to plug because the size of the comparison network necessary to compute the median grows with the amount of pixels to compare.