Results 1 to 10 of 10

Math Help - Obtaining the normal of a plane from the yaw and elevation angles

  1. #1
    Newbie
    Joined
    Jul 2010
    Posts
    9

    Obtaining the normal of a plane from the yaw and elevation angles

    Hi,
    I wasn't sure if this should be in geometry or trig, so apologies if I picked the wrong one.

    My supervisor hinted that the normal of a plane, as viewed from a camera (using the pinhole model) could be obtained from the yaw rotation ( \psi) and angle of elevation ( \theta) as per:

    <br />
 \textbf{\underline{n}}' = \left(<br />
		\begin{array}{ccc}<br />
                         \cos^{-1}( \psi )\\<br />
			 \cos( \theta ) \\<br />
			 \sin( \theta )<br />
		\end{array}<br />
	    \right) \quad , \quad<br />
    \textbf{\underline{n}} = \frac{\textbf{\underline{n}}'}{||\textbf{\underlin  e{n}}'||}<br />

    I've since realised that the  \cos^{-1}(  \psi ) is wrong for the x component, and believe it to be cos( 2\,\pi - \psi ), although I'm not sure and can't prove it as this is only a hunch. Would anyone be able to help me understand and/or correct this?

    EDIT:
    I've read up on my vector theory and know that the x component should be  \cos( \psi ) , however this gives me a yaw angle of 85^\circ on an example normal I have, which seems quite unlikely. This could be due to the components being normalised to make the normal vector unit, although I don't know to what extent it would have been normalised. To find my normal, I used a decomposition method from a full camera homography.

    Many thanks in advance
    Last edited by ianhales; January 5th 2011 at 07:08 AM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Hmm. Any chance you could give us a picture of the situation? With angles and plane and normal vector labeled, please? Thanks!
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jul 2010
    Posts
    9
    A relevant figure from my report is attached. I hope it makes sense. If not, I can draw up a more simple example!

    EDIT:
    Sorry, I just noticed, this doesn't have the angles on. I've attached another which should hopefully illustrate the angles.
    Attached Thumbnails Attached Thumbnails Obtaining the normal of a plane from the yaw and elevation angles-web_gp_from_angle.jpg   Obtaining the normal of a plane from the yaw and elevation angles-web_camera-origin.jpg  
    Last edited by ianhales; January 5th 2011 at 08:25 AM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Ok, thanks for the pictures. I have a few more questions:

    1. What is being held fixed, and what is rotating, when you consider the yaw and angle of elevation?
    2. Where is the origin?
    3. What variables are known, and what variables are unknown?
    4. Does the camera have the ability to measure distances (this is sort of going along with 3)?

    Thanks!
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jul 2010
    Posts
    9
    Hi,
    Thanks for your time so far Answers below:

    1. I'm working with stationary cameras, with the aim of establishing the normal vector of the linear plane it views. I'm given a fixed angle of elevation (90-180 degrees) and yaw angle (-20 to 20 degrees) and from that need to establish the x, y and z components of the normal to the plane (i.e. it's direction relative to the camera). I'm not sure if that answers your question.
    2. At the camera.
    3. We know theta and psi but do not know any components of n. We do know that n must be unit, but can normalise to enforce this. We also fix the distance of the camera from the plane.
    4. Technically no, it's just a single, stationary, handheld video camera. However we do fix d within a feasible range (emprically gathered) of between 2 and 10 (this is obviously dependant on the context of my work).


    A bit of further background to try to explain my problem:

    I need this for two key methods:
    1. Given the yaw and elevation, I want to be able to construct a simulated plane, i.e. gain the normal, so that I can plot points on the plane, for varying values of "d" (the distance of the camera from the plane).
    2. Given some unit normal of a plane, I'd like to be able to assess its validity by determining (approximately) the yaw and elevation angles. I realise there will be difficulties due to the normalisation that may have occured to ensforce the unit-assumption, although am assuming a low normalisation variable (i.e. ||n'|| ~ 1.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Ok, so let me re-state the problem, and see if you agree with this (problem definition is absolutely crucial! In my job, I often spend as much time defining a problem as solving it.)

    You have a fixed camera that is looking at a plane. This plane has been rotated from what we could call an initial position of being normal to the line between the camera and the point on the plane closest to the camera. This line, from the camera to the point on the unrotated plane closest to the camera, we'll call the z-axis. Now, given that the plane has been rotated about the z-axis through a yaw angle \psi, and then about the x-axis through an elevation angle \theta, find the unit normal vector to the plane.

    There are two features about this problem statement about which I particularly want your opinion.

    1. It seems to me that it is the plane that's being rotated relative to a fixed camera. Is that correct?

    2. In three dimensions, the order of rotations is important, because it is NOT true that I can do a yaw followed by an elevation, and get the same thing as if I did an elevation followed by a yaw. In two dimensions, rotations are commutative (order doesn't matter), but you obviously have three dimensions. So would you agree that the yaw is happening first, and then the angle of elevation, or is it the reverse that is happening?

    Believe it or not, I think we are almost at a solution. It will involve rotation matrices in three dimensions, but I should be able to give you a formula for the normal vector, and show you why it is so.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jul 2010
    Posts
    9
    Your statement of my problem seems spot on. Couldn't have put it better myself (quite literally!).

    Quote Originally Posted by Ackbeet View Post
    1. It seems to me that it is the plane that's being rotated relative to a fixed camera. Is that correct?
    I think it's the other way round (unless I've misinterpreted). The plane in question could be, for example, a pavement or road, with a stationary camera being e.g. at the top of a pole. I need to establish the angle of the ground-plane, in order to reconstruct the scene in 3D (to scale).
    So in terms of which is fixed, I think it makes more sense to define the ground as fixed, although it's essentially the 3D angle of rotation of the ground W.R.T. the camera I need.

    Quote Originally Posted by Ackbeet View Post
    2. In three dimensions, the order of rotations is important, because it is NOT true that I can do a yaw followed by an elevation, and get the same thing as if I did an elevation followed by a yaw. In two dimensions, rotations are commutative (order doesn't matter), but you obviously have three dimensions. So would you agree that the yaw is happening first, and then the angle of elevation, or is it the reverse that is happening?
    Hmmm, that makes sense, although in terms of which is first, I'm honestly not sure. Would you have any idea which?

    I've just had an impromptu meeting with my 2nd supervisor, and he suggested the normal vector could be the following, although wasn't sure:

    \textbf{\underline{n}}' = \left(<br />
		\begin{array}{ccc}<br />
      \frac{\pi}{2} - \cos( \psi ) \\<br />
			 \cos( \theta ) \\<br />
			 \sin( \theta )<br />
		\end{array}<br />
	    \right)

    That seems subjectively feasible to me, although justification-wise I'm a bit dubious.

    Thanks very much for your help thus far!
    Follow Math Help Forum on Facebook and Google+

  8. #8
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Hmm. I hear you, but mathematically, I think you're going to run into problems by thinking about the problem that way. The reason has to do with the origin. If the camera is at the origin, and the plane is fixed relative to that origin, then you always know the unit normal vector! It's just

    \hat{n}=\begin{bmatrix}0\\0\\-1\end{bmatrix}.

    I think you have to think about this problem from "inside the camera". Imagine yourself inside the camera. You're presented with a plane that is normal to your (we'll call it uni-directional) line of vision. All of a sudden, the plane rotates one way, and then another, and the plane is no longer normal to your line of vision. Then, relative to your line of vision in the +z direction, say, you want to know what the normal vector is. Let's idealize this situation, and assume that you can't feel (or measure) the camera rotating (which is what is physically happening, as you've said). I do think that, since the normal vector to the plane is "glued" to the plane, we can think about rotating the plane's normal vector while holding the camera fixed. This is a mathematical construct, I grant you, but I think it's the best way to solve the problem.

    In terms of which rotation comes first, I have had to take a test vector, and rotate it in my mind through the two rotations in order to find out which comes first. My hunch is that the elevation has to happen first, because if the yaw happened first, it would leave the normal vector unchanged (vectors don't change if you rotate them about their axis), and hence the yaw angle would have no effect on your final answer (whereas clearly, it does have an effect!).

    Here is my analysis, then. The camera is fixed, and is pointing in the +z direction. The normal vector to the unrotated plane is then equal to

    \hat{n}_{0}=\begin{bmatrix}0\\0\\-1\end{bmatrix},

    because it is pointing back to the camera. We apply an angle of elevation rotation, which I'll abbreviate AoE for subscripting purposes. Now, this is tricky, because of the signs. Think carefully here: let's say we're physically rotating the camera through a positive x-rotation. According to the wiki, the matrix

    R_{x}(\theta)=\begin{bmatrix}<br />
1 &0 &0\\<br />
0 &\cos(\theta) &-\sin(\theta)\\<br />
0 &\sin(\theta) &\cos(\theta)<br />
\end{bmatrix}

    rotates the positive x axis towards the positive y axis. However, since we're looking at everything from the point of view of the normal vector rotating, we have to change the sign of the angle (that is, change the direction from clockwise to counter-clockwise). Hence, utilizing the evenness of the cosine function, and the oddness of the sine function (or you could just as easily think of the inverse of the matrix, which, since rotations are unitary, is just the transpose of the original matrix), our rotation is the following:

    R_{\text{AoE}}(\theta)=\begin{bmatrix}<br />
1 &0 &0\\<br />
0 &\cos(\theta) &\sin(\theta)\\<br />
0 &-\sin(\theta) &\cos(\theta)<br />
\end{bmatrix}.

    Applied to our normal vector, we get

    R_{\text{AoE}}(\theta)\hat{n}_{0}=\begin{bmatrix}<br />
1 &0 &0\\<br />
0 &\cos(\theta) &\sin(\theta)\\<br />
0 &-\sin(\theta) &\cos(\theta)<br />
\end{bmatrix}\begin{bmatrix}0\\0\\-1\end{bmatrix}=\begin{bmatrix}<br />
0\\ -\sin(\theta)\\ -\cos(\theta)<br />
\end{bmatrix}.

    Next, we apply the yaw rotation. Again, the angle must be reversed from the usual z axis rotation,

    R_{z}(\psi)=\begin{bmatrix}<br />
\cos(\psi) &-\sin(\psi) &0\\<br />
\sin(\psi) &\cos(\psi) &0\\<br />
0 &0 &1<br />
\end{bmatrix},

    to obtain

    R_{\text{yaw}}(\psi)=\begin{bmatrix}<br />
\cos(\psi) &\sin(\psi) &0\\<br />
-\sin(\psi) &\cos(\psi) &0\\<br />
0 &0 &1<br />
\end{bmatrix}.

    Applying this to our already-angle-of-elevation-rotated normal vector yields

    R_{\text{yaw}}R_{\text{AoE}}(\theta)\hat{n}_{0}=<br />
\begin{bmatrix}<br />
\cos(\psi) &\sin(\psi) &0\\<br />
-\sin(\psi) &\cos(\psi) &0\\<br />
0 &0 &1<br />
\end{bmatrix}\begin{bmatrix}<br />
0\\ -\sin(\theta)\\ -\cos(\theta)<br />
\end{bmatrix}<br />
=<br />
\begin{bmatrix}<br />
-\sin(\psi)\sin(\theta)\\<br />
-\cos(\psi)\sin(\theta)\\<br />
-\cos(\theta)<br />
\end{bmatrix}<br />
=-\begin{bmatrix}<br />
\sin(\psi)\sin(\theta)\\<br />
\cos(\psi)\sin(\theta)\\<br />
\cos(\theta)<br />
\end{bmatrix}.<br />

    This, then, is my candidate answer for the normal vector after the rotations you've indicated. It's definitely plausible, because it looks a lot like the transformation into spherical coordinates, which transformation involves an angle of elevation rotation about the x axis, followed by the yaw rotation about the z axis. You can also verify, in a straight-forward manner, that this rotated vector is a unit vector with the usual Euclidean norm.

    Do run this candidate through some tests, and see if it gives you plausible answers. I may not have thought through the problem carefully enough, and I may have gotten directions mixed up.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jul 2010
    Posts
    9
    I cannot thank you enough for your help. That all makes perfect sense, and having run some tests, seems to give feasible answers.

    Thanks again for helping me work through this, and your clear and detailed explanations!
    Ian
    Follow Math Help Forum on Facebook and Google+

  10. #10
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Great! You're very welcome. It was a very fun problem.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Angles of Elevation and Depression
    Posted in the Geometry Forum
    Replies: 1
    Last Post: March 2nd 2010, 02:28 PM
  2. Angles of Elevation and Deppresion
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: January 20th 2010, 05:57 AM
  3. Angles of Elevation and Depression??
    Posted in the Geometry Forum
    Replies: 2
    Last Post: May 11th 2009, 02:14 PM
  4. Angles of Elevation?
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: August 20th 2008, 04:32 PM
  5. angles of elevation and depression
    Posted in the Calculus Forum
    Replies: 1
    Last Post: November 28th 2007, 09:37 PM

Search Tags


/mathhelpforum @mathhelpforum