MATLAB Answers

How to change the Image colour of ones and zeros to white and black

21 views (last 30 days)
Akakan-Abasi Okon
Akakan-Abasi Okon on 18 Jun 2021
Commented: Image Analyst on 21 Aug 2021 at 15:38
The mage has 50 x 100 points (vertical x horizontal dimension). Each point can be zero or one, where zero = white colour and one = black colour.
I tried this
B = randi([0 1],50, 100);
The output image is represented with yellow and blue but I want it to be black and white.

Accepted Answer

Image Analyst
Image Analyst on 18 Jun 2021
You don't need a colormap. Just try this:
B = randi([0 1],50, 100);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!