Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Angle between Pixels of an image
Date: Sat, 3 May 2008 20:36:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 60
Message-ID: <fviibj$nq$1@fred.mathworks.com>
References: <fvi2l2$21r$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1209846963 762 172.30.248.37 (3 May 2008 20:36:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 3 May 2008 20:36:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:466447



"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