how to display image from array coloring specific values in white
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
keisuke shimokawa
am 10 Nov. 2017
Beantwortet: Walter Roberson
am 10 Nov. 2017
Hi,
I have a 501x501 matrix.
This matrix contains some values and zero values like below matrix.
a =
1 2 3 8 4
4 7 0 9 1
8 0 0 0 1
9 3 0 6 7
9 4 7 2 7
I want to display image from this kind of array coloring zero values in white because i cannot do this using image func image(a,'CDataMapping','scaled')
How can i do this?
thank,
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Nov. 2017
color_in_white_here = double(a == 0);
white_color = ones(size(a,1), size(a,2), 3);
image(a, 'CDataMapping','scaled');
hold on
image(white_color, 'AlphaData', color_in_white_here);
hold off
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Display Image finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!