how to partion an image and then apply otsu method on each block
3 次查看(过去 30 天)
显示 更早的评论
hi i tried to divide the image into smaller blocks and then i applied otsu method on each block,in order to have a better result for my project on image segmentation but my code didn't work and i also have no idea how to show the final result could you please check my code
I = imread('Data (25).tif');
I = I(:,:,1); I = imadjust(I); [img_x,img_y]=size(I);
block_size=8; slide_len=1;
for ix=block_size/2:slide_len:img_x-block_size/2 for jy=block_size/2:slide_len:img_y-block_size/2 current_block=img((ix-block_size/2+1):(ix+block_size/2),(jy-block_size/2+1):(jy+block_size/2));
level = graythresh(current_block);
current_block = im2bw(current_block,level);
current_block= bwareaopen(current_block, 50);
dct_coeff=reshape(dct2(current_block),1,block_size^2);
end
end
0 个评论
回答(1 个)
Image Analyst
2014-3-7
See my demo for finding text on a page using local Otsu and Sobel filters, attached.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!