MATLAB: I divided the 512*512 image into 8*8 nonoverlapping blocks, I need to select 1024 blocks and apply dwt and svd to each block

image processingMATLAB

I divided the 512*512 image into 8*8 non-overlapping blocks. I get total 4096 blocks, now i want to select first 1024 blocks from 4096 blocks and apply dwt and svd to each block, can anyone tell me how to write the code

Best Answer

Check demo code:
A = rand(512,512) ;
[M,N] = size(A) ;
nx = 8 ; ny = 8 ;
m = M/nx ; n = M/ny ;
l = size (A) ./ [m n];
T = mat2cell (A, repmat (m, l(1), 1), repmat (n, l (2), 1));
M = cellfun(@mean,T,'un',0) ;
M = cellfun(@mean,M,'un',0) ;
M = cell2mat(M)