Real time pixel position in a GUI

I have a series of images which change as a function of time (i.e. a 3D matrix, two spatial, one time). I would like to display one time frame of the image inside a GUI and then display the intensity of a pixel as a function of time on a second axis. Right now, I am using the ginput function so I have to click on individual pixels and the graph updates after each click.
Is it possible to update the cursor position in real time so that, instead of having to click many times, the graph will update as I move the cursor over the image? There is a partial solution to this posted (see "Can Matlab determine cursor position continuously?") but I'm not sure how to implement it inside a GUI.
- Mark

回答 (3 件)

Image Analyst
Image Analyst 2013 年 2 月 15 日

1 投票

Yes. Call the impixelinfo() function. With a 2D color or gray scale image displayed, running the mouse over the image will show the coordinates and RGB values or gray levels of the pixel under the cursor.
Mark Wagshul
Mark Wagshul 2013 年 2 月 15 日

0 投票

Thanks, but that will only display the pixel position and image value in the window (bottom of the figure). I need to have access to the pixel position in the workspace in order to display a plot of the pixel value across all time points. This is what I wasn't able to figure out.

1 件のコメント

Image Analyst
Image Analyst 2013 年 2 月 15 日
Please move this to a comment on my Answer.

サインインしてコメントする。

Walter Roberson
Walter Roberson 2013 年 2 月 15 日

0 投票

get(0, 'CurrentPoint')
inside a WindowButtonMotionFcn callback

3 件のコメント

Image Analyst
Image Analyst 2013 年 2 月 15 日
Then extract a column through your time series and plot it:
intensityAtThisLocation = image3D(y, x, :);
axes(handles.axesPlot);
plot(intensityAtThisLocation, 'r-', 'LineWidth', 3);
grid on;
title('Intensity as function of time', 'FontSize', 25);
KAE
KAE 2017 年 6 月 9 日
Where do x and y come from in your first line?
Image Analyst
Image Analyst 2017 年 6 月 10 日
It's your choice. Perhaps you got them from regionprops identifying the centroid of some blob. Perhaps you called ginput(). How do you want to specify your coordinate?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2013 年 2 月 14 日

コメント済み:

2017 年 6 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by