|
"zaheer ahmad" <ahmad.zaheer@yahoo.com> wrote in message <fvi2l2$21r
$1@fred.mathworks.com>...
>
> I am working on Cursive ( Urdu/Arabic )Optical character
> Recognition (OCR )System. i need to find out the flow of
> pixels or angle between pixels (i.e. angle between pixel1
> and pixel5)
> is it possible using any existing filters in matlab. if yes
> which filter and where to find help regarding the filter.
> the image is of binary type.
> Presently i am scanning the image for black pixels, storing
> the pixels location then using ' atan2 ' find the angle.
> the complete code is as below:
>
> clear
> clc
> Img=im2bw(imread('SingleWord.bmp'));
> imshow(Img);hold on; axis manual;
> [Ymax, Xmax] = size(Img);
>
> points=[22,22];
> xx=0;yy=0;
> for y=Ymax:-1:1
> for x=Xmax:-1:1
>
> if Img(y,x)==0
> plot(x,y,'Color','r','LineWidth', 0.5,'Marker','.');
> xx=xx+1;
> yy=yy+1;
>
> points(xx,yy)=x;
> points(xx+1,yy)=y;
>
> break;
> end
> end
> end
>
>
> for i=1:25
> for j=1:25
>
> PA=atan2((points(i,j+1)-points(i+1,j+1)),((points(i,j+1)-points(i,j))))
> end
> end
>
> It gives me a list of angles as expected but with errors.
> the code is given here for explaining my aim and to make it
> sure you follow me.
> thanks in advance.
-------
Could you please describe in words, fully, carefully and precisely, what the
array 'points' is meant to contain and how large a size it is intended to
expand to? As it stands, it seems to be an array that you are filling in only
along two diagonals and thereby leaving it with mostly zeros. These zeros
will cause you grief later when you call on 'atan2' with numerous cases of
atan2(0,0), which will produce irate error messages.
Roger Stafford
|