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 ,
2 次查看(过去 30 天)
显示 更早的评论
plz help me with matlab code
5 个评论
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?
采纳的回答
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
2017-2-28
Looks like you're describing the local binary pattern, and I'm attaching my demo for that.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!