POV-Ray : Newsgroups : povray.newusers : Affine or Perspective: I need to estimate the camera motion from two views Server Time
2 Nov 2024 01:21:53 EDT (-0400)
  Affine or Perspective: I need to estimate the camera motion from two views (Message 1 to 2 of 2)  
From: amjad
Subject: Affine or Perspective: I need to estimate the camera motion from two views
Date: 20 Sep 2004 12:10:00
Message: <web.414f00a01dd02242dba5e0750@news.povray.org>
When we have the camera place at <0,0,-z> looking at <0,0,0> with a simple
object in sight; say a square of length 3 units and centered at <1,1,10>
and we do a simple rotation i.e. around X-axis, the simple rotation matrix
given by [1 0 0;0 cos -sin;0 sin cos] indicates that all x coordinate  will
stay the same! But in reality, a parallel vertical lines will converge to a
point far away, thus the x-coordinates are changing as well as the

stay parallel. Is there a way to represent this perspective rotation in a
single matrix?

Take the points at the Upper Left and Lower Left corner in the original
Square with pixel values at <178,115> and <179,268>. After applying the
rotation matrix we get <226,77> and <186,362> which is NOT the same
according to:

New_Point_Coord=Rotation_Matrix * Old_Point_Coord! (am I doing something
wrong?)
since translation is assumed zero, and this is a single rotation?

What I'm trying to do is to be able to predict the new coordinate of the
object given a known rotation of a Camera placed at <0,0,-z>. This will be
used in conjunction of corresponding points between two images of the same
objects taking from 2 different views to derive the camera parameters
(Essential or Fundamental matrix).

I've posted a similar question at the advanced group and thankfully got some
hint from Tor Olav

Here is the simple Code. Pixel values obtained when rotation was set to
zero, and then measured with the mouse and direct reading.



// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5;

#include "colors.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

box {
   -<1, 1, 5>, <1, 1, 5>
   pigment { color rgb <1, 1, 1> }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare Camera1 =
   camera {
     location <0, 0, -10> // or location -10*z
     look_at <0, 0, 0>   // ot look_at 0*y
     rotate <40, 0, 0>   // or rotate 40*y
   }

#declare Angle = radians(-40);

#declare Camera2 =
   camera {
     location -10*z
     look_at 0*y
     matrix <
       1, 0         , 0,
       0, cos(Angle), -sin(Angle),
       0, sin(Angle), cos(Angle),
                0, 0,           0
     >
   }

camera { Camera1 }
//camera { Camera2 }

light_source { <1, 2, -3>*100 color rgb <1, 1, 1> }

background { color rgb <0.9, 0.8, 0.7> }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Warp
Subject: Re: Affine or Perspective: I need to estimate the camera motion from two views
Date: 21 Sep 2004 06:44:31
Message: <4150060f@news.povray.org>
amjad <amj### [at] okstateedu> wrote:
> When we have the camera place at <0,0,-z> looking at <0,0,0> with a simple
> object in sight; say a square of length 3 units and centered at <1,1,10>
> and we do a simple rotation i.e. around X-axis, the simple rotation matrix
> given by [1 0 0;0 cos -sin;0 sin cos] indicates that all x coordinate  will
> stay the same! But in reality, a parallel vertical lines will converge to a
> point far away, thus the x-coordinates are changing as well as the
> y-coordinate. This affine Matrix can?t capture this, and parallel line will
> stay parallel. Is there a way to represent this perspective rotation in a
> single matrix?

  I don't understand what you are thinking about the transformation
matrix.

  The transformation matrix you give above will indeed not change
the x-coordinates of the object being transformed, but it will
naturally change its y and z coordinates. Since the z-coordinates
are being modified, some of the points will end up closer to the
camera (which was located at -z*10) than originally, and other
points will end up being farther than originally. Thus the
perspective will naturally affect vertical lines.
  This is exactly what rotating around the X axis does.

  The same applies if you are transforming the camera: By rotating the
camera you will basically just be changing its location and orientation.
A simple rotation of the camera does not affect perspective.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.