How to select graph coordinates using given input value?

1 vue (au cours des 30 derniers jours)
Lavanya
Lavanya le 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?

Réponses (1)

Walter Roberson
Walter Roberson le 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);

Catégories

En savoir plus sur Graph and Network Algorithms 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