Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting pixel coordinates efficiently in Matlab

I would like to create a function in Matlab that, given an image, will allow one to select a pixel by clicking on it in the image and return the coordinates of the pixel. Ideally, one would be able to click on several pixels in the image in succession, and the function would store all the respective coordinates in a matrix. Is there a way to do this in Matlab?

like image 325
jake Avatar asked May 09 '26 14:05

jake


1 Answers

ginput

Graphical input from mouse or cursor Syntax

    [x,y] = ginput(n) 
    [x,y] = ginput 
    [x,y,button] = ginput(...)

Description

[x,y] = ginput(n) enables you to identify n points from the current axes and returns their x- and y-coordinates in the x and y column vectors. Press the Return key to terminate the input before entering n points.

like image 111
Jacob Avatar answered May 11 '26 03:05

Jacob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!