MATLAB: Replace elements in binary matrix

binary matrixImage Processing Toolbox

I have a binary image and want to replace all the zeroes with 1s and all the 1s with zeroes. ( so that the binary image is totally opposite to original image). How can i do that?

Best Answer

% B original binary matrix
% B_ new binary matrix
B_ = ~B;
Related Question