how to partion an image and then apply otsu method on each block

2 Ansichten (letzte 30 Tage)
mohamad mohamad
mohamad mohamad am 7 Mär. 2014
Beantwortet: Image Analyst am 7 Mär. 2014
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

Antworten (1)

Image Analyst
Image Analyst am 7 Mär. 2014
See my demo for finding text on a page using local Otsu and Sobel filters, attached.

Community Treasure Hunt

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

Start Hunting!

Translated by