How to select graph coordinates using given input value?

3 visualizaciones (últimos 30 días)
Lavanya
Lavanya el 19 de Sept. de 2022
Respondida: Walter Roberson el 19 de Sept. de 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?

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Sept. de 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);

Categorías

Más información sobre Data Exploration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by