Replace elements in binary matrix

4 visualizaciones (últimos 30 días)
Abdul Salam
Abdul Salam el 29 de Jun. de 2019
Comentada: Abdul Salam el 29 de Jun. de 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?

Respuesta aceptada

Michal
Michal el 29 de Jun. de 2019
Editada: Michal el 29 de Jun. de 2019
% B original binary matrix
% B_ new binary matrix
B_ = ~B;

Más respuestas (1)

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

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by