main.m1123 chars30 lines
This code reads in an image matrix and creates a new matrix of the same size to hold the updated values. It then loops through each pixel (except for the edges) of the original matrix and checks if the intensity value is between 900 and 1300. If it is, it checks if the intensity values of the adjacent pixels are also between 900 and 1300 using logical indexing. If they are, it calculates the average of the intensity values of the current pixel and its adjacent pixels and stores the result in the corresponding pixel of the new matrix. The new matrix is then converted back to an image and displayed.
gistlibby LogSnag