Apply hanning window to all the blocks

1 view (last 30 days)
If I have an Image of 256x256 and I want to divide it into 32x32 regions, I can do it using following code. But If I want to apply hanning window to all the blocks how can I do that?
rgbImage = imread('image.jpg');
rgbImage = imresize(rgbImage, [256 256]);
[rows columns numberOfColorBands] = size(rgbImage)
ca = mat2cell(rgbImage,32*ones(1,size(rgbImage,1)/32),32*ones(1,size(rgbImage,2)/32),3);
plotIndex = 1;
for c = 1 : size(ca, 2)
for r = 1 : size(ca, 1)
fprintf('c=%d, r=%d\n', c, r);
subplot(8,8,plotIndex);
imshow(ca{r,c});
plotIndex = plotIndex + 1;
end
end
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

Accepted Answer

Image Analyst
Image Analyst on 11 Jan 2014
ca{r, c} is the array in that block. Multiply that by a hanning array that is the same size. Use hanning() or hann().

More Answers (0)

Community Treasure Hunt

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

Start Hunting!