I have a binary mask which labeled the foreground of image. Many image processing algorithms such as histogram equalization or otsu method deal with the whole image. My question is how to apply those image processing algorithms so that they can ONLY process the region which my binary mask labeled?
For example, I
is the grayscale image and BW
is the binary mask. The code below still process the whole image rather than the specific region labeled by the BW
mask.
level = graythresh(I.*BW);
BW = im2bw(I.*BW,level);