How to extract pixel position from Image in app designer ?
5 ビュー (過去 30 日間)
古いコメントを表示
Basically , I am devleping an matlab app using matlab app designer.In that I want to exterct pixel position for ferther operation.
I have tried impoint and ginput but proble with that is they are opening grap in new window, I want to select pixel from the same app window.

1 件のコメント
回答 (1 件)
Siraj
2023 年 9 月 7 日
Hi! It is my understanding that you have an image displayed in the app designer and would like to obtain the coordinates of the pixel that the mouse pointer is currently hovering over.
To extract the coordinates of the pixel under the mouse pointer in an image displayed in the app designer, you can utilize the "datacursormode" function. This function enables interactive data exploration by creating and editing data tips, which are small text boxes displaying information about specific data points. To better understand the implementation, refer to the provided code example below:
% Button pushed function: TrackanImageButton
function TrackanImageButtonPushed(app, event)
img = imread("TestImage.jpeg");
img = rgb2gray(img);
dcm = datacursormode(ancestor(app.UIAxes, 'figure'));
dcm.Enable = 'on';
imshow(img, 'Parent',app.UIAxes)
end
I have also included the design view of the app for your reference,

For a more comprehensive understanding of “datacursormode” and its configuration options to suit your specific requirements, refer to the link below.
Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!