MATLAB: Multiple Regions of Interest, maybe

image processingImage Processing Toolbox

Hello Everyone,
Working on a project for summer research. Basically I have a 2D slice of a 3D image volume, and I need to find values on either side of edges within this image.
What I have: Original Image Values, Binary Edge Map
I have already used a Bresenham's line algorithm equivalent in order to identify the last pixel a specified "ray" passes through (giving me an initial and final value at the edge), but the problem is that the edge itself is multiple pixels thick (think gradient) and getting the immediate neighbor results in a very small difference not representative of the actual difference I am looking for.
One potential is to find the mean of a region on one side and then a region on the other (while not necessarily segmenting/thresholding the entire image because then it might just create a few distinct values across the whole image when I really would like it to be more accurate), with each region probably being a 10×10 square and finding the mean of one side and the other. I think the method to do this is with ROI, but is it possible to use this automatically over EACH edge point without using for loops?
Wondering if people are familiar with methods to figure this out. Any thoughts are welcome, and if there is any confusion or more information necessary, please don't hesitate to ask!
Thank you!

Best Answer

Try nlfilter() to make your own custom filter that will apply at each pixel as the window scans the image.