MATLAB Answers

Manu BN
0

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

Asked by Manu BN
on 27 Jan 2015
Latest activity Commented on by Manu BN
on 28 Jan 2015
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.

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 27 Jan 2015
 Accepted Answer

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

Dear Sir, Those 16 image blocks had varying sizes so I put it in cell. Now i made sure all r same size wth the help of floor command.
T_arr = [T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16];
Mosaic = zeros(size(Target,1), size(Target,2),3);
% Put the tile images into the Mosaic cnt = 1; for i = 1:1:4 for j=1:1:4 %Mosaic(i,j) = tiles(cnt); Mosaic(i,j) = T_arr(cnt) cnt = cnt+1; end end
At the end of execution Mosaic image has only zeros.
Please help. Thanks in advance, Manu B.N
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.