J = roifilt2(h, I, BW) filters the data in I with the two-dimensional linear filter h. BW is a binary image the same size as I that defines an ROI used as a mask for filtering. roifilt2 returns an image that consists of filtered values for pixels in locations where BW contains 1's, and unfiltered values for pixels in locations where BW contains 0's. For this syntax, roifilt2 calls filter2 to implement the filter. For reference^ So as I understand it h is a "correlation kernel" which describes any number of filters. Average, sharpening, whatever. So say mine is a 5x5 averaging filter to blur my image. Now, when I set my region of interest in BW, I tell roifilt2 which pixels to bother with. so say I set it to a single pixel. Only that pixel is modified, but what I don't know is are the other pixels surrounding it used in this modification? Surely if you want to specify a region of interest, anything outside this is not of interest, so it shouldn't be used in the filtering process. But I have a feeling it is. Does anyone know if it is or not?