Replace elements in binary matrix

2 Ansichten (letzte 30 Tage)
Abdul Salam
Abdul Salam am 29 Jun. 2019
Kommentiert: Abdul Salam am 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?

Akzeptierte Antwort

Michal
Michal am 29 Jun. 2019
Bearbeitet: Michal am 29 Jun. 2019
% B original binary matrix
% B_ new binary matrix
B_ = ~B;

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 29 Jun. 2019
B_ = imcomplement(B);

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by