How do you plot gray values in a picture?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Shashank Gupta
2020년 12월 30일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!