Why do image coordinate switches when using getpts function?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2017년 12월 1일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!