[Solved] how to extract each characters from a image?with using this code


Why don’t you simply use regionprops with 'Image' property?

img = imread('http://i.stack.imgur.com/zpYa5.png');  %// read the image
bw = img(:,:,1) > 128;  %// conver to mask

Use some minor morphological operations to handle spurious pixels

dbw = imdilate(bw, ones(3)); 
lb = bwlabel(dbw).*bw;  %// label each character as a connected component

Now you can use regionprops to get each image

st = regionprops( lb, 'Image' );

Visualize the results

figure;
for ii=1:numel(st),  
    subplot(4,5,ii);
    imshow(st(ii).Image,'border','tight');
    title(num2str(ii));
end

enter image description here

1

solved how to extract each characters from a image?with using this code