How to select graph coordinates using given input value?

1 view (last 30 days)
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?

Answers (1)

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

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!