How to process each non-overlapped block of an image after it's sub-division?
Ältere Kommentare anzeigen
My function sub-divides an image into non-overlapping blocks (each block is a cell matrix). I wonder how to process each block and then recombine them to make a processed image? Let's say I want to apply fast Walsh Hadamard transform (fwht2) on each block. Here is my function:
if true
function Blocks = imageBlock(I)
[m,n] = size(I);
Blocks = cell(m/8,n/8);
counti = 0;
for i = 1:8:m-7
counti = counti + 1;
countj = 0;
for j = 1:8:n-7
countj = countj + 1;
Blocks{counti,countj} = I(i:i+7,j:j+7);
end
end
end
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 14 Mär. 2018
2 Stimmen
Use blockproc() and give it your function. It can be whatever you want. See attached examples.
4 Kommentare
Mohsin Shah
am 14 Mär. 2018
Bearbeitet: Walter Roberson
am 14 Mär. 2018
Walter Roberson
am 14 Mär. 2018
fh = @(block_struct) fwht2d(block_struct.data);
Mohsin Shah
am 14 Mär. 2018
Bearbeitet: Mohsin Shah
am 14 Mär. 2018
Image Analyst
am 14 Mär. 2018
You can only accept one, but you can Vote for mine. Voting will also give the answerer reputation points. You can vote for as many as you want.
Kategorien
Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!