Why do image coordinate switches when using getpts function?
显示 更早的评论
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.
回答(1 个)
Walter Roberson
2017-12-1
0 个投票
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 个评论
Arbol
2017-12-2
Walter Roberson
2017-12-2
How are you constructing xcoord and ycoord ?
Arbol
2017-12-2
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!