필터 지우기
필터 지우기

Create an array containing coordinate points

조회 수: 26 (최근 30일)
Savannah D
Savannah D 2020년 10월 15일
댓글: Matt J 2020년 10월 16일
I have two images (a reference and annotated image). The reference image is 11250x14008x3 that was stitched together from smaller tiles using imtile. The annotated image was coregistered to the reference image and color ROIs were extracted from the annotations. The tiles were given x_y names (from x001_y001 to x030_y038). I now need to essentially back track through the stitching to find the specific tiles that the ROI would have been in.
I created two arrays, one containing all points for x (1:11250) and y (1:14008) and divided them into cells corresponding to the x_y names of the tiles (i.e., the x-array is 1x30 and y-array is 1x38). I now need to create all the coordinates that would exist in each of those tiles but each tile is 375x375.
indx = im_size(1)/xmax; % im_size refers to the reference image; xmax is 30
xpix1 = 1;
xpix2 = indx;
for m = x(1):x(2) % creates 1x30 cell, with each cell containing 375x1 double
x_coord{m} = [xpix1:xpix2]';
xpix1 = xpix1 + indx;
xpix2 = xpix2 + indx;
if xpix2 > im_size(1)
break
end
end
I did the same thing for y so i have y_coord as 1x38 cell, with each cell containing 375x1 double.
I want to now create coordinates out of those x_coord and y_coord variables, but I am having hard time accessing the infomation within the cells.
  댓글 수: 1
Rik
Rik 2020년 10월 15일
Can't you just divide by the tile size and round to find the tile indices?

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2020년 10월 15일
편집: Matt J 2020년 10월 15일
Usinge mat2tiles from the File Exchange,
[X,Y]=ndgrid(1:11250,1:14008);
X=mat2tiles(X,[375,375]);
Y=mat2tiles(Y,[375,375]);
  댓글 수: 2
Savannah D
Savannah D 2020년 10월 15일
This worked great! Thank you!
Matt J
Matt J 2020년 10월 16일
Although, it would save RAM considerably to do,
X=mat2tiles(1:11250,[1,375]);
Y=mat2tiles(1:14008,[1,375]);
so that tile (i,j) could be extracted as,
referenceImage(X{i},Y{j},:)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by