|
|
please help me
Posted:
Jun 15, 2012 10:22 PM
|
|
filename='font4.png'; I=imread(filename);
[bar,kol,z]=size(I); if z==3 bw=im2bw(I,.5); else bw=I; end bw=~bw;
bw=bwconncomp(bw, 4); bw=labelmatrix(bw);
stats=regionprops(bw,{'centroid','boundingbox'});
imshow(I); title('How to count characters in an image','fontsize',14); hold on;
for k=1:length(stats); cent=stats(k).Centroid; boks=stats(k).BoundingBox; plot(cent(1),cent(2),'bo','MarkerSize',5,'MarkerFaceColor','g'); bx=[boks(1),boks(1),boks(1)+boks(3),boks(1)+boks(3),boks(1)]; by=[boks(2)+boks(4),boks(2),boks(2),boks(2)+boks(4),boks(2)+boks(4)]; line(bx,by,'color','r'); pause(.01); end
xlabel(sprintf('There is %d characters counted',length(stats))); hold off;
------------------------------------------------------------------------------------------------------------------------ ??? Undefined function or method 'bwconncomp' for input arguments of type 'double'.
Error in ==> TA_PCD at 12 bw=bwconncomp(bw, 4); ------------------------------------------------------------------------------------------------------------------------
why the error occurred? can you solve the problem? thank you so much
|
|