How to select graph coordinates using given input value?

1 Ansicht (letzte 30 Tage)
Lavanya
Lavanya am 19 Sep. 2022
Beantwortet: Walter Roberson am 19 Sep. 2022
Here I am enclosing ' .m' file. In this file using ginput(), (x,y) coordinates are extracted. Then these values are assigned to table columns. But I need to select the (x,y) coordinates by using edifields input value instead of using ginput(). Later on these values should assign to the table and select the graph as well(like image1.jpg)
Can anyone help me with this?

Antworten (1)

Walter Roberson
Walter Roberson am 19 Sep. 2022
Assuming image1 is grayscale (you might need to rgb2gray() it)
values = interp2(1:size(image1, 1), 1:size(image1, 2), image1, query_y_locations, query_x_locations)
Notice the order is y and then x.
This assumes that your coordinates might be non-integers and that you want interpolation according to the surrounding points. If you want the nearest pixel from the image instead of interpolating then
ind = sub2ind(size(image1), round(query_y_locations), round(query_x_locations));
values = image1(ind);

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by