6
$\begingroup$

I have a set of points on a unit sphere representing different orientations:

enter image description here

Now I need to apply rotation(s) such that the points will lay on the horizon as tightly as possible:

enter image description here

The ideal representation for rotation would be YPR (Yaw-Pitch-Roll), but any axis-angle representation would suffice.

Here is where I got up to now:

  1. Find "centroid" orientation for the given orientations (How to find centroid of points laying on sphere?) The result would be some vector $u=(x,y,z)^{\mathbb{T}}$, $||u||=1$

  2. Compute normalizing yaw and pitch angles (maybe using atan2 ?) so that the rotated vector $u'=(0,0,1)$

  3. Compute roll angle (around $u'$) so that the points lay on the horizon line (the horizon is intersection of the sphere and a plane $y=0$). Maybe a least squares approach? Or compute average of normalizing angles for the points?

The problem arises in panoramic image stitching where I need to remove "wavy" effect from the projected mosaic (every image is represented by rotation around common center):

enter image description here

Note that the full 360° mosaic is a special case. I need to "straighten" partial mosaic as well, which are like the bunch of points depicted above.

  • 0
    What I would do is find the normal to the horizon *first*, as in [your previous question](http://math.stackexchange.com/q/131359/856). Once that is fixed, you're left with the much simpler one-dimensional problem of choosing the rotation about the normal, or equivalently, of choosing the horizontal center of the flattened image.2012-04-14
  • 0
    Thanks. The problem is that I also need to straighten partial mosaics as well. The mosaic can also contain several rows of images and user can choose an arbitrary central point, so that I am afraid the "up-vector" approach would not work always. Sometimes the mosaic can be vertically oriented (e.g. tower image) and then the roll rotation should be completely omitted.2012-04-14
  • 0
    I'm afraid I don't understand the point of your comment. How does the arrangement of images in the mosaic relate to the question of rotating points on a sphere to lie on the equator? I assumed you had the images registered on the sphere already, with points on the horizon marked, and only needed to choose the view direction to project the mosaic onto a plane so that the horizon is drawn horizontal. Am I misunderstanding your problem?2012-04-14
  • 0
    Yes you understand it right. The problem is that I need to split the global rotation of the mosaic to three parts (yaw, pitch, roll), because there are other considerations because of which I cannot use the simple approach from the previous question. First, user can choose hiw own center point (it can also be chosen based on existing direction to choose the "most central" one). Second, the roll may not sometimes be used (e.g. when the mosaic is taken diagonally or vertically). This is why I need to split the process in three rotations and find the corresponding angles...2012-04-15
  • 1
    IMHO, switching to yaw/pitch/roll too early in your calculations is a serious mistake here; they're a notoriously miserable representation of rotations for problems like this because they have almost none of the properties you'd like your orientation to have. I'd much rather work with a quaternion or matrix representation here (where rotations can be easily composed, for instance) and only convert to Euler angles at the very last step.2012-07-19

2 Answers 2