i have divided an RGB image into 4*4 non overlapping blocks. Aft which I hv stored the blocks into a cell array if the standard deviation value is more than a fixed value. Now I wan to put these 16 images back and reconstruct the image. How do i do

1 view (last 30 days)
This cell array contains the 16 blocks:
T_arr = {T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16};
I have a blank image which is same size as the original undivided image:
Mosaic = cell(size(Original,1), size(Original,2),3);
cnt = 1;
for i = 1:1:4
for j=1:1:4
Mosaic{i,j} = T_arr{cnt};
cnt = cnt+1;
end
end
After execution with no error, the Mosaic image contains all blank images. Plz Help.

Accepted Answer

Image Analyst
Image Analyst on 27 Jan 2015
How did you determine that the Mosaic cell array consists of cells that contain completely blank images?
You aren't just doing imshow(Mosaic) are you, because you can't do that. Are you actually looking in the variable editor at the contents of the individual cells? But I have no idea why you're creating a cell array with the same number of cells across and the same number of cells down as your image? Why???? You only have 16 cells to begin with, not a million or so. Do you want Mosaic to be an RGB image or grayscale image (which would make sense), or do you really want it to be a cell array with millions of cells but of which you're only using the tiny 4 by 4 upper left corner of it (like you're doing and which makes little sense)?
I'm pretty sure you don't know how to use cell arrays and the FAQ should help with that: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
  3 Comments
Image Analyst
Image Analyst on 28 Jan 2015
Edited: Image Analyst on 28 Jan 2015
Now you've changed it. Now T_arr is a numerical matrix instead of a cell array as before. Which is it? If they have different number of rows, it must be a cell array. It can be a numerical array if the Tn have the same number of rows, but different number of columns.
Why not just do
Mosaic = [T1,T2,T3,T4;T5,T6,T7,T8;T9,T10,T11,T12;T13,T14,T15,T16]
Why bother with cell arrays and loops if you have the Tn???

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!