After the splitting/dividing of an image to 3x3 sub-blocks, how do I choose a specific sub-block for my image processing. After that particular sub-block is done image processing, all the sub-blocks image are combinn to a single figure. Thanks.

1 view (last 30 days)
%# desird number of horizontal/vertical tiles to divide the image into
numBlkH = 3; %%Row
numBlkW = 3; %%Column
%# compute size of each tile in pixels
[imgH,imgW,~] = size(InputImage);
szBlkH = [repmat(fix(imgH/numBlkH),1,numBlkH-1) imgH-fix(imgH/numBlkH)*(numBlkH-1)];
szBlkW = [repmat(fix(imgW/numBlkW),1,numBlkW-1) imgW-fix(imgW/numBlkW)*(numBlkW-1)];
%# divide into tiles, and linearize using a row-major order
C = mat2cell(InputImage, szBlkH, szBlkW)';
C = C(:);
%# display tiles i subplots
figure
for i=1:numBlkH*numBlkW
subplot(numBlkH,numBlkW,i), imshow( C{i} )
end

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!