Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Finding "y" co-ordinate

Subject: Finding "y" co-ordinate

From: Archana Ananthanarayan

Date: 20 Apr, 2008 17:16:02

Message: 1 of 11

I've a problem with the implementation of the following
problem :

Consider an image of size m x n. Now, we bifurcate the image
into two parts column wise( vertically). the X co-ordinates
of all the rows are same. Now from each row we need to draw
lines from different angles. say from 0 to 15 degrees. But,
to do this we need to find y co-ordinate at that position.
how to achieve this? is any concept from calculus or
geometry helful?

Subject: Finding

From: Archana Ananthanarayan

Date: 21 Apr, 2008 04:40:42

Message: 2 of 11

Just to bring this thread up!!

If someone knows the answer pls reply!!

Subject: Finding

From: Roger Stafford

Date: 21 Apr, 2008 05:05:03

Message: 3 of 11

"Archana Ananthanarayan" <archana1985_ms@hotmail.com> wrote in message
<fuftoi$qut$1@fred.mathworks.com>...
> I've a problem with the implementation of the following
> problem :
>
> Consider an image of size m x n. Now, we bifurcate the image
> into two parts column wise( vertically). the X co-ordinates
> of all the rows are same. Now from each row we need to draw
> lines from different angles. say from 0 to 15 degrees. But,
> to do this we need to find y co-ordinate at that position.
> how to achieve this? is any concept from calculus or
> geometry helful?
-------------
  You will have much better luck getting answers if you explain your request far
more extensively. As it stands I can't understand what you are asking. Try
giving a concrete example of what you are trying to accomplish.

Roger Stafford

Subject: Finding

From: Archana Ananthanarayan

Date: 21 Apr, 2008 12:10:04

Message: 4 of 11

Ok, Here i Go:

I've a scanned document image. I partition the image into
two slabs vertically. Now, in each slab, I've to draw
horizontal scan lines. I've to consider each row and draw
the lines. But the data i will have will be just the angle
thetha and the X co-ordinate. How do i find the y co-ordinate?

Do respond with your ideas! Thanks!


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
wrote in message <fuh79v$fap$1@fred.mathworks.com>...
> "Archana Ananthanarayan" <archana1985_ms@hotmail.com>
wrote in message
> <fuftoi$qut$1@fred.mathworks.com>...
> > I've a problem with the implementation of the following
> > problem :
> >
> > Consider an image of size m x n. Now, we bifurcate the image
> > into two parts column wise( vertically). the X co-ordinates
> > of all the rows are same. Now from each row we need to draw
> > lines from different angles. say from 0 to 15 degrees. But,
> > to do this we need to find y co-ordinate at that position.
> > how to achieve this? is any concept from calculus or
> > geometry helful?
> -------------
> You will have much better luck getting answers if you
explain your request far
> more extensively. As it stands I can't understand what
you are asking. Try
> giving a concrete example of what you are trying to
accomplish.
>
> Roger Stafford
>

Subject: Finding

From: Roger Stafford

Date: 21 Apr, 2008 15:55:03

Message: 5 of 11

"Archana Ananthanarayan" <archana1985_ms@hotmail.com> wrote in
message <fui06s$5bb$1@fred.mathworks.com>...
> Ok, Here i Go:
>
> I've a scanned document image. I partition the image into
> two slabs vertically. Now, in each slab, I've to draw
> horizontal scan lines. I've to consider each row and draw
> the lines. But the data i will have will be just the angle
> thetha and the X co-ordinate. How do i find the y co-ordinate?
>
> Do respond with your ideas! Thanks!
----------
  You still haven't expressed yourself clearly, in my opinion, Archana. What
do the "slabs" have to do with the "lines", the "data", and the "coordinates"?
Coordinates of what points? Where? In what relation to one another?

  I'll try to make a guess as to your problem, but mind you it is a wild guess.
If you have a line drawn from the coordinate origin (0,0) to a point with
coordinates (x,y) and you know only x and the angle, theta, the line makes
with the x-axis, then you can determine y as y = x*tan(theta).

  However, that is such a trivial identity of elementary trigonometry, I doubt
that is what you are asking. Try again to explain what it is you really want to
know. Try to imagine you were explaining the problem to some grade school
children and were drawing the problem on a blackboard. What pictures
would you draw? Then translate those pictures clearly into words for us. Our
abilities to read minds is limited.

Roger Stafford


Subject: Finding

From: Archana Ananthanarayan

Date: 22 Apr, 2008 02:16:02

Message: 6 of 11

http://www.iis.sinica.edu.tw/papers/fchang/2018-F.pdf


Am trying to implement this paper as a part of my project!
Can you infer anything?




"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
wrote in message <fuidcn$pm7$1@fred.mathworks.com>...
> "Archana Ananthanarayan" <archana1985_ms@hotmail.com>
wrote in
> message <fui06s$5bb$1@fred.mathworks.com>...
> > Ok, Here i Go:
> >
> > I've a scanned document image. I partition the image into
> > two slabs vertically. Now, in each slab, I've to draw
> > horizontal scan lines. I've to consider each row and draw
> > the lines. But the data i will have will be just the angle
> > thetha and the X co-ordinate. How do i find the y
co-ordinate?
> >
> > Do respond with your ideas! Thanks!
> ----------
> You still haven't expressed yourself clearly, in my
opinion, Archana. What
> do the "slabs" have to do with the "lines", the "data",
and the "coordinates"?
> Coordinates of what points? Where? In what relation to
one another?
>
> I'll try to make a guess as to your problem, but mind
you it is a wild guess.
> If you have a line drawn from the coordinate origin (0,0)
to a point with
> coordinates (x,y) and you know only x and the angle,
theta, the line makes
> with the x-axis, then you can determine y as y = x*tan(theta).
>
> However, that is such a trivial identity of elementary
trigonometry, I doubt
> that is what you are asking. Try again to explain what it
is you really want to
> know. Try to imagine you were explaining the problem to
some grade school
> children and were drawing the problem on a blackboard.
What pictures
> would you draw? Then translate those pictures clearly
into words for us. Our
> abilities to read minds is limited.
>
> Roger Stafford
>
>

Subject: Finding

From: Roger Stafford

Date: 22 Apr, 2008 07:48:02

Message: 7 of 11

"Archana Ananthanarayan" <archana1985_ms@hotmail.com> wrote in
message <fujhp2$hh7$1@fred.mathworks.com>...
> http://www.iis.sinica.edu.tw/papers/fchang/2018-F.pdf
> Am trying to implement this paper as a part of my project!
> Can you infer anything?
----------
  From the indicated paper I have abstracted what I think you are trying to do,
Archana.

  Starting at a certain spatial position (x1,y1) (where x1 and y1 are integers,)
you wish to draw a line at some specified angle t degrees with respect to the
x-axis running through (x1,y1) over to the right as far as x-coordinate x2.
You would like a list of all integer y-coordinates that best match points on
the line y = y1 + (x-x1)*tan(t). When stated this way the problem almost
solves itself.

 x = (x1:x2);
 y = round(y1+(x-x1)*tand(t));

  To take a very small example, let x1 = 45, x2 = 56, y1 = 25, and t = 15
degrees. Then we have

 x = (x1:x2)
   = 45 46 47 48 49 50 51 52 53 54 55 56

 y = round(25+(x-45)*tand(15))
   = 25 25 26 26 26 26 27 27 27 27 28 28

These constitute the 12 pairs of x,y coordinates you would want to access on
the image array along this 15-degree "line".
  
  Of course you need to convert these spatial coordinates to corresponding
pixel coordinates, and you will probably want to use the matlab function
'sub2ind' or its equivalent for access of this type.

  I wouldn't be surprised if there were already such a function as this in the
image processing toolbox.

Roger Stafford


Subject: Finding

From: Archana Ananthanarayan

Date: 22 Apr, 2008 09:47:01

Message: 8 of 11

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
wrote in message <fuk57h$e3o$1@fred.mathworks.com>...
> "Archana Ananthanarayan" <archana1985_ms@hotmail.com>
wrote in
> message <fujhp2$hh7$1@fred.mathworks.com>...
> > http://www.iis.sinica.edu.tw/papers/fchang/2018-F.pdf
> > Am trying to implement this paper as a part of my project!
> > Can you infer anything?
> ----------
> From the indicated paper I have abstracted what I think
you are trying to do,
> Archana.
>
> Starting at a certain spatial position (x1,y1) (where x1
and y1 are integers,)
> you wish to draw a line at some specified angle t degrees
with respect to the
> x-axis running through (x1,y1) over to the right as far as
x-coordinate x2.
> You would like a list of all integer y-coordinates that
best match points on
> the line y = y1 + (x-x1)*tan(t). When stated this way the
problem almost
> solves itself.
>
> x = (x1:x2);
> y = round(y1+(x-x1)*tand(t));
>
> To take a very small example, let x1 = 45, x2 = 56, y1 =
25, and t = 15
> degrees. Then we have
>
> x = (x1:x2)
> = 45 46 47 48 49 50 51 52 53 54 55 56
>
> y = round(25+(x-45)*tand(15))
> = 25 25 26 26 26 26 27 27 27 27 28 28
>
> These constitute the 12 pairs of x,y coordinates you would
want to access on
> the image array along this 15-degree "line".
>
> Of course you need to convert these spatial coordinates
to corresponding
> pixel coordinates, and you will probably want to use the
matlab function
> 'sub2ind' or its equivalent for access of this type.
>
> I wouldn't be surprised if there were already such a
function as this in the
> image processing toolbox.
>
> Roger Stafford
>
>
----------------------------------------------------------



Hey,

I think i've got it cleared!! i wil ltry this and will post
results with regards to this!

THANKS!!

Subject: Finding

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 22 Apr, 2008 12:35:38

Message: 9 of 11

In article <fuk57h$e3o$1@fred.mathworks.com>,
Roger Stafford <ellieandrogerxyzzy@mindspring.com.invalid> wrote:

> From the indicated paper I have abstracted what I think you are trying to do,
>Archana.

> Starting at a certain spatial position (x1,y1) (where x1 and y1 are integers,)
>you wish to draw a line at some specified angle t degrees with respect to the
>x-axis running through (x1,y1) over to the right as far as x-coordinate x2.
>You would like a list of all integer y-coordinates that best match points on
>the line y = y1 + (x-x1)*tan(t). When stated this way the problem almost
>solves itself.

> x = (x1:x2);
> y = round(y1+(x-x1)*tand(t));


>These constitute the 12 pairs of x,y coordinates you would want to access on
>the image array along this 15-degree "line".

If the goal is to find the x,y coordinates that you would want to
access on the image array along the line, then you may have duplicate
x coordinates. Consider for example any line whose slope is 2 or more
(or -2 or less).

When I did this some months ago, I realized the key was to
step along the coordinate that varied more, calculating the other
coordinate for each step. Thus for angles between -45 and 45,
or between 135 and 225, use the formula above, but with angles
outside that range, increment along y instead, calculating x for
each y.
--
   "No one has the right to destroy another person's belief by
   demanding empirical evidence." -- Ann Landers

Subject: Finding

From: Archana Ananthanarayan

Date: 7 May, 2008 18:57:04

Message: 10 of 11

As proposed, i've implemented this piece of code and ts
working. i've some small problems and i hope someone will
help me out.

I've taken an image and taken its binary equivalent. after
this, i draw the lines from x to y at various angles. The
new y values are of fractional values. hence i take the
int32(y) for the co-ordinates.

I've to see whether the binary_image(x,y) has a white pixel.
i've taken the condition for this to be equal to a zero, but
this is not working. is something wrong with my condition?

Subject: Finding

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 7 May, 2008 19:09:27

Message: 11 of 11

In article <fvsu20$39c$1@fred.mathworks.com>,
Archana Ananthanarayan <archana1985_ms@hotmail.com> wrote:

>I've to see whether the binary_image(x,y) has a white pixel.
>i've taken the condition for this to be equal to a zero, but
>this is not working. is something wrong with my condition?

Depends upon your convention. In colour and greyscale images,
higher value is higher intensity, so white is associated with
maximum intensity for them, not with minimum intensity. For
binary images, you can use either way around as long as you use
it consistenty and remember that the image display operators
expect 0 to mean black.
--
  "Prevention is the daughter of intelligence."
                                              -- Sir Walter Raleigh

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics