MATLAB Answers

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

조회 수: 3(최근 30일)
Manu BN
Manu BN 27 Jan 2015
Commented: Manu BN 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;
After execution with no error, the Mosaic image contains all blank images. Plz Help.

  댓글 수: 0

로그인 to comment.

채택된 답변

Image Analyst
Image Analyst 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:

  댓글 수: 3

Manu BN
Manu BN 28 Jan 2015
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
Image Analyst
Image Analyst 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???

로그인 to comment.

More Answers (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by