How to convert the digit image into (3*2) blocks where I can check vertical and horizontal edges ? Actually, I need to check if vertical or horizontal edges exists in each block? If exists I need to return binary value 1.
2 次查看(过去 30 天)
显示 更早的评论
The sample digit image is attached.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197315/image.png)
0 个评论
采纳的回答
KSSV
2018-10-8
A = imread('image 2.png') ;
m = 3 ; n = 2 ;
[nx,ny] = size(A) ;
if mod(nx,3)
nx = nx+(3-mod(nx,3)) ;
end
if mod(ny,2)
ny = ny+(2-mod(ny,2)) ;
end
A = imresize(A,[nx ny]) ;
l = size (A) ./ [m n];
T = mat2cell (A, repmat (m, l(1), 1), repmat (n, l (2), 1))
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!