MATLAB: How to work on the white region of this binary mask Image Processing Toolboxmammogrammaskroi I have a mammogram database and I want to apply some features on the white region. Best Answer One easy way is to just process the whole image and then erase the resulting image outside the maskoutputImage = some algorithm using the entire image....maskedOutputImage = outputImage; % InitializemaskedOutputImage(~mask) = 0; % Set to zero outside the mask. Related SolutionsMATLAB: How to do masking with the help of binary image repmat your binary image across the three colour channels and use the invert of that as logical index into your colour image to set the pixels to 0:colourmask = repmat(binarymask, [1 1 3]);maskedimage = colourimage;maskedimage(~colourmask) = 0; MATLAB: How to extract black pixels and white ones in a grayscale image If black pixels are considered those with values equal to or less than "threshold", you can donumBlackPixels = nnz(grayImage <= threshold);If white pixels are considered those with values equal to or greater than "threshold", you can donumWhitePixels = nnz(grayImage >= threshold); Related QuestionHow can we map binary image on original RGB imageAssign black pixels to binary image
Best Answer