Display a small matrix as a gray scale image
Show older comments
I have a small text file called "my_img_data.txt".
I want to display it as a grey scale image.
I am using
>>T1 = load('my_img_data.txt')
T1 =
120 250 214 82
250 214 82 120
214 82 120 250
250 214 82 120
T2 = T2 = mat2gray(T1,[0 255])
>>T2 =
0.4706 0.9804 0.8392 0.3216
0.9804 0.8392 0.3216 0.4706
0.8392 0.3216 0.4706 0.9804
0.9804 0.8392 0.3216 0.4706
>> imshow(T2)
It displays an image in gray scale, but only as 4x4 pixels out of something like 256x256, so I can hardly see it. How can I make it so it shows just the 4x4 pixels?
By the way, if I use image(T1), I get just the 4x4 pixels, but it's a color map. I want grey scale.
Thank you,
Maarten
Accepted Answer
More Answers (1)
T2 =[
0.4706 0.9804 0.8392 0.3216
0.9804 0.8392 0.3216 0.4706
0.8392 0.3216 0.4706 0.9804
0.9804 0.8392 0.3216 0.4706];
imshow(T2, 'InitialMagnification', 10000); % Adjust number as needed.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

