Info

This question is closed. Reopen it to edit or answer.

I have 256*256 image. I had converted into 4*4 blocks. Now I have 64*64 blocks. And also I had converted each 4X4 into 16X1 column vector. Now I have 256 arrays, each have 16*1. I want to calculate mean value of first 8 arrays, then next 8 arrays,.

1 view (last 30 days)
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; nn=0; for i=1:4:nr-3
for j=1:4:nc-3
block=I(i:i+3,j:j+3);
disp(block)
%convert 4X4 into 16X1 column vector
tv=reshape(block,16,1);
disp(tv)
column=column+4;
% R = blkproc(tv,[1 8],@(x) mean(x(:)))
end
row=row+4;
end
%B=mean(tv,8,[],16,256) %B=sepblockfun(I,[4,2],'mean'); disp(i) disp(j) R = blkproc(tv,[12 8],@(x) mean(x(:)))
[nr nc nd]=size®

Answers (0)

Community Treasure Hunt

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

Start Hunting!