Replace elements in binary matrix

4 visualizzazioni (ultimi 30 giorni)
Abdul Salam
Abdul Salam il 29 Giu 2019
Commentato: Abdul Salam il 29 Giu 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?

Risposta accettata

Michal
Michal il 29 Giu 2019
Modificato: Michal il 29 Giu 2019
% B original binary matrix
% B_ new binary matrix
B_ = ~B;

Più risposte (1)

Walter Roberson
Walter Roberson il 29 Giu 2019
B_ = imcomplement(B);

Categorie

Scopri di più su Read, Write, and Modify Image in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by