Stitching sub images to reconstruct full image
24 views (last 30 days)
I have subdivided an image into 4x4 tiles and produced a subimage and obtained a binary imaged. I add each of these binary images to a binary stack using a loop.
After the loop, how do I reconstruct/stitch the sub binary images back to the full image size, so I can create a binary image representing the while raw image so to use as a mask:
My binary sub images are expressed as :
BI(:,:,i) %where i is 1:16 as I'm using 4x4 tiles
This is my approach that isn't working:
%Now combine binary images so to create regions to act as mask on original
size(BI) %Confirm there are 16 planes of images in the binarystack
Binary=; %Create empty Binary Image that will hold reconstructed sub images
Mohammad Abouali on 14 Jan 2015
Edited: Mohammad Abouali on 14 Jan 2015
Again, why don't you use blockproc()? :D
what you are asking, i.e. stitching the sub images into one big one, can be done in a single command using blockproc() as follows:
Binary=blockproc( reshape(1:16,4,4)', [1,1], @(x) BI(:,:,x.data) );
where Binary contains all the sub images placed in the order you show in the figure. 16 sub images are not much but if there were more you can even do this in parallel as easily as:
Binary =blockproc( reshape(1:16,4,4)', [1,1], @(x) BI(:,:,x.data), 'UseParallel',true);
More Answers (6)
Iain on 13 Jan 2015
depending how you've done it....
BInew = permute(BI,[1 3 2]);
BInew = reshape(BInew,16*size(BI,1),);
ought to work.
Image Analyst on 13 Jan 2015
Why bother saying this:
if you're just going to say this
three lines later? Not only that, but you switched rows and columns. The first index should be rows, not columns as you have it, and the second index should be columns, not rows as you have it.