Matrix elements to pixel colors
Ältere Kommentare anzeigen
Hello there,
I have a 3000*3000 matrix, elements of which are either 0 or 1. I want to make an image out of it, at which every element matches to a pixel.
The pixels will have black color if the value of the element is 0 and white if the value is 1. Any ideas?
Thank you for your interest!
Antworten (2)
I = randi(2,3000,3000)-1;
my_image = imshow(I);
get(my_image)
1 Kommentar
Tasos Kamenides
am 6 Feb. 2022
Image Analyst
am 6 Feb. 2022
You state "I have a 3000*3000 matrix, elements of which are either 0 or 1. I want to make an image out of it". Well, your matrix already IS an image. There is nothing you have to do. To prove it, you can simply display your matrix:
imshow(yourMatrix, []); % Display yourMatrix as an image.
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
