MATLAB: How to remove pixels in an image

image processingMATLAB

Hi,
I need to remove pixels with zero pixel value in an image(dead pixels)
I have to fill the pixel value with zero with the average of the neighbourhood pixel values.
Can anyone suggest me something about this
Thanks in advance

Best Answer

Detect the zero pixels to create a mask. Then use conv2() to get the average. Then make an output image the same as your input image. Then assign the "zero pixel locations" of your output image to the zero pixel locations of your convolved image. Is that good enough explanation for you to figure it out, or do you require the full code (which I don't have time to give you right now)?