Unsing ginput to reading pixel in graylevel image

조회 수: 7 (최근 30일)
Sara
Sara 2021년 7월 14일
댓글: Image Analyst 2021년 7월 15일
Hi,
I wondered if anyone knows a function or method used to read the pixel values in an image. Here is what I mean. I have a gray-level image, and I can use the ginput function to select the coordinates. How can I use the ginput to read the intensity value in the gray image as "live" or before select the position? The reason for doing this, I want to know what is the highest intensity value that my ginput pointing to. As you know, some images gradient in the intensity value.
I was reading to the ginput code itself, but I only could change the arrow color instead of black to red. I could not understand or modify the code itself to read the intensity value when I point to the intensity area in the image.
  댓글 수: 2
DGM
DGM 2021년 7월 14일
If your goal is to find the point of highest intensity, why are you using ginput to do it manually? Are you trying to find the highest intensity in a particular user-selected local region? If so, you should realize that you're not likely to have a very good time finding it if your image is scaled for display.
Assuming that's the actual root purpose, you can just define an ROI and find the max within that. For example:
inpict = imread('coins.png');
s = size(inpict);
imshow(inpict); hold on;
P = drawpolygon(); % select one of the coins with a polygon selection
maskedpict = inpict.*uint8(createMask(P));
[mx idx] = max(maskedpict(:)) % max value and linear index
[row col] = ind2sub(s(1:2),idx) % or row and column subs
delete(P);
plot(col,row,'bo') % show max location
Otherwise, you might want to clarify.
Sara
Sara 2021년 7월 15일
Thank you for your answer.
I am sorry I was not clear about why I use ginput.
The image that I have is a bend close to the periphery. I want to plot the intensity profile for the column that is close to the periphery. I mange that, but I needed a more accurate way to select the coordinates.
Here is an attached for the image that I work on it. As you can see the image is bending.
I use the gunput to slelect 3 points (or more )in the clumns and plot the slection in the improfile funcation. Now I want to use ginput where is the highest intsity so that I can select it.
NOTE: The image is a colored map to show the intensity changing along with the columns.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 7월 14일
Call impixelinfo():
imshow(yourImage);
impixelinfo; % Show "live" status bar on figure with (x,y) and RGB or gray scale.
  댓글 수: 2
Sara
Sara 2021년 7월 15일
Thank you for your answer,
I will get to the function that you suggestion.
Image Analyst
Image Analyst 2021년 7월 15일
You're welcome. Can you please "Accept this answer" if it worked for you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by