MATLAB Answers

i have binary image and need to divide it into blocks

1 view (last 30 days)
Samar Ragab
Samar Ragab on 28 Aug 2018
Answered: Yuvaraj V on 28 Aug 2018
First i need to divide a binary image into 8x8 block.Second, in each blocks,check if number of 1s is larger than 0s,if larger number of 1s,then i need to calculate some features,else do nothing

Accepted Answer

Yuvaraj V
Yuvaraj V on 28 Aug 2018
if true
I = binary_image;
numBlkH = 8;
numBlkW = 8;
[imgH,imgW,~] = size(I);
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)];
C = mat2cell(I, szBlkH, szBlkW)';
C = C(:);
for i=1:numBlkH*numBlkW
subplot(numBlkH,numBlkW,i), imshow( C{i} )


Sign in to comment.

More Answers (0)