Why do image coordinate switches when using getpts function?
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Walter Roberson
on 1 Dec 2017
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!