How do you plot gray values in a picture?
4 views (last 30 days)
Show older comments
Lynn Grimberg
on 21 Dec 2020
Commented: Lynn Grimberg
on 31 Dec 2020
Hi,
For a project we have to answer the following question:
Generate the Shepp‐Logan head phantom image P using the MATLAB command P =
phantom(‘Shepp-Logan’,n) with for n the value 256, indicating the number
of columns and rows. Convert the image to double and show it on the screen (use
im2double and imshow). Apply if necessary display scaling in order to improve
the visualization of the ellipses, measure the gray values of the different ellipses and
plot these values in a black and white picture of the phantom (ginput or
impixelinfo).
What we have so far for our code in MatLab is:
n = 256;
P = phantom('Shepp-Logan',n);
Pphoto = im2double(P);
width = 15;
length = 0.1;
BetterPphoto = Pphoto.*width + length;
figure(1), imshow(BetterPphoto); %see added picture for the figure
InfoBetterPphoto = impixelinfo;
The gray values we got from impixelinfo are: 0.10, 0.40, 0.20, 0.75, 0.55 and 15.10
We're having trouble with the last part of the question: measure the gray values of the different ellipses and plot these values in a black and white picture of the phantom. How do we plot these gray values in the black and white picture of the phantom?
Black and white phantom.
Figure 1
Thanks in advance for your help!
0 Comments
Accepted Answer
Shashank Gupta
on 30 Dec 2020
Hi Lynn,
I am not really sure if I understand your concern properly. But what you intend to do is to measure the gray values for different ellipses in the phantom and plot them. One thing you need to take in mind that these values which you got from impixelinfo is not the absolute gray values for ellipses instead this are additive intensities. First you need to convert them into absolute gray values and then you shall plot it whenever it is required. Check out this link for detail explaination.
I hope this helps you.
Cheers
More Answers (0)
See Also
Categories
Find more on Axis Labels 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!