I have an image with red, green, blue channel and a binary version of the image.
What I want to do is concatenate those 2 images so that the binary image works as th
If you have a 3-D image I and a binary mask M, you can mask the irrelevant bits to zero either by multiplying the image by the mask:
I
M
I = bsxfun(@times, I, M);
or by logical indexing:
I(~mask(:, :, ones(1, size(I, 3)))) = 0;