help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: logm on 4x4 affine matrices.


From: John Swensen
Subject: Re: logm on 4x4 affine matrices.
Date: Mon, 10 May 2010 07:14:52 -0400

On May 10, 2010, at 1:30 AM, Andrew Janke wrote:

> Hi all,
> 
> Here's hoping someone can point me in the right direction...
> 
> I need to average a few affine transformation matrices so have been doing 
> this:
> 
>> AVG = expm((logm(A000) + logm(A001)) / 2)
> 
> However the "translation component" doesn't seem to behave as I would expect.
> 
> ie:
> 
> octave:3> A000 = [1 0 0 0; 0 1 0 0; 0 0  1 0; 0 0 0 1];
> octave:4> A001 = [1 0 0 1; 0 1 0 2; 0 0  1 3; 0 0 0 1];
> octave:5> AVG = expm((logm(A000) + logm(A001)) / 2)
> warning: inverse: matrix singular to machine precision, rcond = 1.42141e-17
> AVG =
> 
>   1   0   0   0
>   0   1   0   0
>   0   0   1   0
>   0   0   0   1
> 
> 
> ?
> 
> On affine matrices with translations that are non-identity things seem
> to be as I would expect.
> 
> Thanks
> 
> 
> -- 
> Andrew Janke - address@hidden
> Department of Geriatric Medicine, ANU
> Canberra->Australia    +61 (402) 700 883

I don't know what the "right" answer is, but I know something that works.  It 
seems that logm and expm should work from the mathematical perspective as 
affine transformations are elements of the Lie group SE(3) and generated via 
the exponential map from the Lie algebra se(3).  The problem may be that when 
taking the matrix log of the identity rotation, the fact that it can be any 
axis of rotation combined with a zero angle makes it not well defined.   I have 
always seen people decompose the affine transformation into a rotation and a 
translation for averaging purposes and use the Rodrigues formula and its 
inverse, rather than matrix log, on the rotational part.

R000 = A000(1:3,1:3);
R001 = A001(1:3,1:3);

T000 = A000(1:4,4);
T001 = A001(1:4,4);

theta000 = rodrigues(R000);
theta001 = rodrigues(R001);

Rave = rodrigues( 0.5*(theta000+theta001) );
Tave = 0.5*(T000+T001);

gave = [ [Rave ; 0 0 0] Tave ];


John Swensen


I use the implementation of rodrigues (which also provide the inverse 
operation) from the camera calibration toolbox provided by CalTech
http://www.vision.caltech.edu/bouguetj/calib_doc/index.html






reply via email to

[Prev in Thread] Current Thread [Next in Thread]