hi, i need to divide 64x64 binary image into 3x3 overlapping blocks, then in each block ,if center value is 0 leave that block as it is, else that block converted into decimal number ,

조회 수: 1 (최근 30일)
plz help me with matlab code
  댓글 수: 5
Guillaume
Guillaume 2017년 2월 28일
편집: Guillaume 2017년 2월 28일
You haven't clarified anything about what form the output should be.
Given the image:
[1 1 1 1
1 1 0 1
1 1 1 1]
which would results in two overlapping blocks:
1 1 1 1 1 1
1 1 0 1 0 1
1 1 1 1 1 1
what's the result supposed to be?
out = {[1 1 1;1 1 0;1 1 1], 255}
according to your description, maybe?
kaavya subramani
kaavya subramani 2017년 2월 28일
no sir,each 3x3 block has either 0 or single decimal number as output,(i.e) 64x64 will be divided as 3x3 overlapping block,then check each block, if center value is 0, the whole 3x3 is changed to single 0 else it is converted into decimal number in the order of idx

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2017년 2월 28일
m = randi([0 1], 64, 64); %demo matrix
out = zeros(size(m) - 3);
for col = 1 : size(m, 2) - 3
for row = 1 : size(m, 1) - 3
block = m(row:row+2, col:col+2);
if block(2, 2)
out(row, col) = polyval(block([1 4 7 8 9 6 3 2]), 2);
end
end
end

추가 답변 (1개)

Image Analyst
Image Analyst 2017년 2월 28일
Looks like you're describing the local binary pattern, and I'm attaching my demo for that.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by