I reshaped the image elements 256*256 into 16*1 linear array using the following code. There is 16 linear arrays in a variable (ex:tv). Now i need to retrieve the first array of variable (tv). ie, i need tv(1), tv(2)... tv(16). Please say the code.
1 view (last 30 days)
Show older comments
I=imread('cameraman.tif'); I=double(I); Im=size(I); %find the size of the image [nr nc nd]=size(I); % Divide into blocks disp(nr); disp(nc);
% Divide into blocks m=64; n=64; row=1; column=1; i=1; j=1; sum=0; count=0; nnn=1; er1=0; for i=1:4:16
for j=1:4:16
block=I(i:i+3,j:j+3);
disp(block)
T = rand(16,16); % Size of all your vectors, concatenated
Tr = reshape(T,[4,4,16])
%convert 4X4 into 16X1 column vector
tv=reshape(block,16,1);
disp(tv)
count=count+1
column=column+4;
end
row=row+4;
end
0 Comments
Answers (1)
Image Analyst
on 20 Feb 2016
I didn't delve into your code but I see you creating a 16x1 vector in it:
tv=reshape(block,16,1);
so what's the problem?
4 Comments
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!