Why do image coordinate switches when using getpts function?
Afficher commentaires plus anciens
I have a 96x256x256 data, and I try to pick a pixel from the 256x256 to get data. When I use the getpts function, I get different x and y coordinates. Here is my approach to my data: 1. I have data that contain x and y coordinates, and data set(size of 96) at x-y coordinate. 2. I re-edited the data so I can put it into a matrix called tissue_map by doing a for loop:
for i = 1:length(xcoord)
tissue_map(:,xcoord(i),ycoord(i)) = tissueData(:,i);
end
After this, I use getpts to get a coordinate on one slice of the matrix, say tissue_map(1,120,130):
fig = imagesc(tissue_map(1,:,:));
[x, y] = getpts(fig);
where I get:
x = 130
y = 120
What is it that I'm doing wrong? I couldn't figure out why.
Réponses (1)
Walter Roberson
le 1 Déc 2017
0 votes
I do not see a problem?
In matrix indexing, "up/down" is row indexing, the first index. Up/down corresponds to Y coordinates. So x = 130, y = 120 is row 120 column 130, index (120,130)
3 commentaires
Arbol
le 2 Déc 2017
Walter Roberson
le 2 Déc 2017
How are you constructing xcoord and ycoord ?
Arbol
le 2 Déc 2017
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!