How to extract pixel position from Image in app designer ?
7 次查看(过去 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 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!