MATLAB Answers

0

Replace elements in binary matrix

Asked by Abdul Salam on 29 Jun 2019
Latest activity Commented on by Abdul Salam on 29 Jun 2019
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?

  0 Comments

Sign in to comment.

Products


Release

R2018b

2 Answers

Answer by Michal Kvasnicka on 29 Jun 2019
Edited by Michal Kvasnicka on 29 Jun 2019
 Accepted Answer

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

  1 Comment

Thanks

Sign in to comment.


Answer by Walter Roberson
on 29 Jun 2019

B_ = imcomplement(B);

  0 Comments

Sign in to comment.