MATLAB: How to check whether the noisy pixel is in a smooth region

decision tree based denoisingimage processingImage Processing Toolboxnoisy pixel

A 3 x 3 mask is adopted.we have to decide whether a pixel is located in smooth region.if the result is negative,then it belongs to noisy-free.else the pixel is noisy.

Best Answer

Use imfilter or conv2() with a kernel [1,1,1;1,0,1;1,1,1] to get the average around the center pixel. Then subtract the average from that filtered image and take the absolute value. Then threshold. If it's bigger than your threshold, it's an outlier. If it's smaller, then it's not an outlier.