Create an array containing coordinate points
27 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Risposta accettata
Matt J
il 15 Ott 2020
Modificato: Matt J
il 15 Ott 2020
Usinge mat2tiles from the File Exchange,
[X,Y]=ndgrid(1:11250,1:14008);
X=mat2tiles(X,[375,375]);
Y=mat2tiles(Y,[375,375]);
2 Commenti
Matt J
il 16 Ott 2020
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},:)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Lighting, Transparency, and Shading in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!