Create an array containing coordinate points

30 次查看(过去 30 天)
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.

采纳的回答

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 个评论
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 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by