Effacer les filtres
Effacer les filtres

How to extract pixel position from Image in app designer ?

11 vues (au cours des 30 derniers jours)
karan padariya
karan padariya le 28 Juin 2022
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.

Réponses (1)

Siraj
Siraj le 7 Sep 2023
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.

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by