i have binary image and need to divide it into blocks

조회 수: 2 (최근 30일)
Samar Ragab
Samar Ragab 2018년 8월 28일
답변: Yuvaraj Venkataswamy 2018년 8월 28일
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

채택된 답변

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018년 8월 28일
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(:);
figure,
imshow(I)
for i=1:numBlkH*numBlkW
subplot(numBlkH,numBlkW,i), imshow( C{i} )
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by