Public Member Functions | Private Member Functions | Private Attributes
m23d_ortho_flexible_builder Class Reference

Algorithm to estimate 3D shape basis from multiple 2D views. More...

#include <m23d_ortho_flexible_builder.h>

List of all members.

Public Member Functions

void reconstruct (const vcl_vector< vcl_vector< vgl_point_2d< double > > > &pt_vec_list, const unsigned &n_modes)
 Reconstruct structure from set of 2d pts.
void partial_reconstruct (const vnl_matrix< double > &P2D, unsigned n_modes)
 Reconstruct approximate structure of 3D points given multiple 2D views.
void reconstruct_with_first_as_basis (const vnl_matrix< double > &P2D, unsigned n_modes)
 Reconstruct structure of 3D points given multiple 2D views.
void reconstruct (const vnl_matrix< double > &P2D, unsigned n_modes)
 Reconstruct structure of 3D points given multiple 2D views.
const vnl_matrix< double > & shape_3d () const
 Return 3(m+1) x np matrix, each column containing modes for one 3D point.
const vnl_matrix< double > & projections () const
 The 2ns x 3(m+1) projection matrix.
const vnl_matrix< double > & centred_views () const
 Centred version of the 2D views supplied to reconstruct().
const vnl_matrix< double > & pure_projections () const
 The 2ns x 3 matrix. Each 2x3 block is the projection for a given view.
const vnl_matrix< double > & coeffs () const
 ns x (m+1) matrix, each row of which contains the weights for a shape.
void refine ()
 Refine estimates of projection and structure.
void correct_coord_frame (vnl_matrix< double > &P, vnl_matrix< double > &B)
 Apply rotation matrices to each 3 columns of P (and inverse to rows of B).
void compute_correction (const vnl_matrix< double > &M1, vnl_matrix< double > &G)
 Compute correction matrix so that M1.G has suitable projection properties.
const vnl_matrix< double > & mean_shape () const
 Return mean 3D shape as a 3 x np matrix.
vnl_matrix< double > shape (unsigned i) const
 Return 3D shape i as a 3 x np matrix.
const vnl_vector< double > & mean_coeffs () const
 Mean coefficients.
void get_shape_3d_pts (vcl_vector< vgl_point_3d< double > > &pts) const
 Return 3d pts given 3*np matrix.

Private Member Functions

void set_view_data (const vnl_matrix< double > &P2D)
 Take copy of 2D points and remove CoG from each.
void initial_decomposition (unsigned n_modes)
 Decompose centred view data to get initial estimate of shape/projection.
void disambiguate_z ()
 Disambiguate the ambiguity in the sign of the z ordinates.
void make_pure_projections ()
 Modify projection matrices so they are scaled orthographic projections.
void compute_mean (vnl_matrix< double > &mean_shape, vnl_vector< double > &mean_coeffs)
 Compute the mean 3D shape.
void mat_to_3d_pts (vcl_vector< vgl_point_3d< double > > &pts, const vnl_matrix< double > &M) const
 Return 3d pts given 3*np matrix.

Private Attributes

vnl_matrix< double > P3D_
 3(1+m) x np matrix, each column containing one 3D point.
vnl_matrix< double > P_
 The 2ns x 3(1+m) projection matrix.
vcl_vector< vgl_point_2d
< double > > 
cog_
 The CoG of each shape supplied to reconstruct().
vnl_matrix< double > P2Dc_
 Centred version of the 2D views supplied to reconstruct().
vnl_matrix< double > pure_P_
 The 2ns x 3 matrix. Each 2x3 block is the projection for a given view.
vnl_matrix< double > coeffs_
 ns x (m+1) matrix, each row of which contains the weights for a shape.
vnl_matrix< double > mean_shape_
 Mean 3D shape as a 3 x np matrix.
vnl_vector< double > mean_coeffs_
 Mean coefficients.

Detailed Description

Algorithm to estimate 3D shape basis from multiple 2D views.

ses the method of Xiao, Chai and Kanade (CVPR 2004). Generates projection matrix, P, and 3D point matrix P3D, such that P2D = P.P3D. Uncertainty in projection is constrained by setting the projection for the first shape to the identity (1 0 0; 0 1 0)

The ambiguity in the sign of the z ordinates is fixed by arranging that the first non-zero z ordinate should be negative.

Note that the 2D point sets will be normalised so that their CoG is at the origin. The resulting 3D shape bases will also have their CoG at the origin.

Definition at line 29 of file m23d_ortho_flexible_builder.h.


Member Function Documentation

const vnl_matrix<double>& m23d_ortho_flexible_builder::centred_views ( ) const [inline]

Centred version of the 2D views supplied to reconstruct().

Each 2D shape has been translated so that its CoG is at the origin

Definition at line 131 of file m23d_ortho_flexible_builder.h.

const vnl_matrix<double>& m23d_ortho_flexible_builder::coeffs ( ) const [inline]

ns x (m+1) matrix, each row of which contains the weights for a shape.

Definition at line 138 of file m23d_ortho_flexible_builder.h.

void m23d_ortho_flexible_builder::compute_correction ( const vnl_matrix< double > &  M1,
vnl_matrix< double > &  G 
)

Compute correction matrix so that M1.G has suitable projection properties.

Definition at line 356 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::compute_mean ( vnl_matrix< double > &  mean_shape,
vnl_vector< double > &  mean_coeffs 
) [private]

Compute the mean 3D shape.

Compute the mean 3D shape using the current co-effs.

Definition at line 573 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::correct_coord_frame ( vnl_matrix< double > &  P,
vnl_matrix< double > &  B 
)

Apply rotation matrices to each 3 columns of P (and inverse to rows of B).

Matrix selected so that projection matrices in each 3 cols have same effective rotation.

Definition at line 387 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::disambiguate_z ( ) [private]

Disambiguate the ambiguity in the sign of the z ordinates.

First non-zero element should be negative.

Definition at line 169 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::get_shape_3d_pts ( vcl_vector< vgl_point_3d< double > > &  pts) const

Return 3d pts given 3*np matrix.

Get back 3d pts rotated and shifted for each frame.

Definition at line 602 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::initial_decomposition ( unsigned  n_modes) [private]

Decompose centred view data to get initial estimate of shape/projection.

Uncertain up to an affine transformation

Definition at line 147 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::make_pure_projections ( ) [private]

Modify projection matrices so they are scaled orthographic projections.

P = s(I|0)*R

Definition at line 479 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::mat_to_3d_pts ( vcl_vector< vgl_point_3d< double > > &  pts,
const vnl_matrix< double > &  M 
) const [private]

Return 3d pts given 3*np matrix.

Return 3d rigid pts, i.e., aligned with first frame.

Definition at line 642 of file m23d_ortho_flexible_builder.cxx.

const vnl_vector<double>& m23d_ortho_flexible_builder::mean_coeffs ( ) const [inline]

Mean coefficients.

Definition at line 160 of file m23d_ortho_flexible_builder.h.

const vnl_matrix<double>& m23d_ortho_flexible_builder::mean_shape ( ) const [inline]

Return mean 3D shape as a 3 x np matrix.

Definition at line 154 of file m23d_ortho_flexible_builder.h.

void m23d_ortho_flexible_builder::partial_reconstruct ( const vnl_matrix< double > &  P2D,
unsigned  n_modes 
)

Reconstruct approximate structure of 3D points given multiple 2D views.

Reconstruct structure of 3D points given multiple 2D views.

Data assumed to be scaled orthographic projections The result is stored in the shape_3d() matrix. The estimated projection matrices are stored in the projections() matrix However, the projection matrices are not necessarily consistent. Call refine() to ensure consistancy, (or use reconstruct(P2D,n_modes) This is exposed to aid testing and debugging.

Parameters:
P2D2ns x np matrix. Rows contain alternating x's and y's from 2D shapes

Data assumed to be scaled orthographic projections The result is stored in the shape_3d() matrix. The estimated projection matrices are stored in the projections() matrix

Parameters:
P2D2ns x np matrix. Rows contain alternating x's and y's from 2D shapes

Definition at line 193 of file m23d_ortho_flexible_builder.cxx.

const vnl_matrix<double>& m23d_ortho_flexible_builder::projections ( ) const [inline]

The 2ns x 3(m+1) projection matrix.

Each 2x3 sub-matrix is a scaled orthographic projection matrix

Definition at line 127 of file m23d_ortho_flexible_builder.h.

const vnl_matrix<double>& m23d_ortho_flexible_builder::pure_projections ( ) const [inline]

The 2ns x 3 matrix. Each 2x3 block is the projection for a given view.

Each 2x3 sub-matrix is a scaled orthographic projection matrix

Definition at line 135 of file m23d_ortho_flexible_builder.h.

void m23d_ortho_flexible_builder::reconstruct ( const vcl_vector< vcl_vector< vgl_point_2d< double > > > &  pt_vec_list,
const unsigned &  n_modes 
)

Reconstruct structure from set of 2d pts.

formulates measurement matrix P2D then calls reconstruct() function

Formulates measurement matrix P2D then calls reconstruct() function

Definition at line 49 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::reconstruct ( const vnl_matrix< double > &  P2D,
unsigned  n_modes 
)

Reconstruct structure of 3D points given multiple 2D views.

Data assumed to be scaled orthographic projections The result is stored in the shape_3d() matrix. The estimated projection matrices are stored in the projections() matrix Automatically select views which form a good basis.

Parameters:
P2D2ns x np matrix. Rows contain alternating x's and y's from 2D shapes

Definition at line 86 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::reconstruct_with_first_as_basis ( const vnl_matrix< double > &  P2D,
unsigned  n_modes 
)

Reconstruct structure of 3D points given multiple 2D views.

Data assumed to be scaled orthographic projections The result is stored in the shape_3d() matrix. The estimated projection matrices are stored in the projections() matrix The first (n_modes+1) views are assumed to define a basis for the modes. This might not be ideal. Use reconstruct() to automatically select views which form a good basis.

Parameters:
P2D2ns x np matrix. Rows contain alternating x's and y's from 2D shapes

Data assumed to be scaled orthographic projections The result is stored in the shape_3d() matrix. The estimated projection matrices are stored in the projections() matrix

Parameters:
P2D2ns x np matrix. Rows contain alternating x's and y's from 2D shapes

Definition at line 30 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::refine ( )

Refine estimates of projection and structure.

Definition at line 555 of file m23d_ortho_flexible_builder.cxx.

void m23d_ortho_flexible_builder::set_view_data ( const vnl_matrix< double > &  P2D) [private]

Take copy of 2D points and remove CoG from each.

Definition at line 123 of file m23d_ortho_flexible_builder.cxx.

vnl_matrix< double > m23d_ortho_flexible_builder::shape ( unsigned  i) const

Return 3D shape i as a 3 x np matrix.

Definition at line 591 of file m23d_ortho_flexible_builder.cxx.

const vnl_matrix<double>& m23d_ortho_flexible_builder::shape_3d ( ) const [inline]

Return 3(m+1) x np matrix, each column containing modes for one 3D point.

Points are centred on the origin. Each 3 rows contains one of the (1+m) bases.

Definition at line 123 of file m23d_ortho_flexible_builder.h.


Member Data Documentation

ns x (m+1) matrix, each row of which contains the weights for a shape.

Definition at line 53 of file m23d_ortho_flexible_builder.h.

vcl_vector<vgl_point_2d<double> > m23d_ortho_flexible_builder::cog_ [private]

The CoG of each shape supplied to reconstruct().

This has been subtracted from each example to centre on the origin Centred data stored in P2Dc_

Definition at line 42 of file m23d_ortho_flexible_builder.h.

Mean coefficients.

Definition at line 59 of file m23d_ortho_flexible_builder.h.

Mean 3D shape as a 3 x np matrix.

Definition at line 56 of file m23d_ortho_flexible_builder.h.

Centred version of the 2D views supplied to reconstruct().

Each 2D shape has been translated so that its CoG is at the origin

Definition at line 46 of file m23d_ortho_flexible_builder.h.

3(1+m) x np matrix, each column containing one 3D point.

Definition at line 33 of file m23d_ortho_flexible_builder.h.

The 2ns x 3(1+m) projection matrix.

Each 2x3 sub-matrix is a scaled orthographic projection matrix

Definition at line 37 of file m23d_ortho_flexible_builder.h.

The 2ns x 3 matrix. Each 2x3 block is the projection for a given view.

Each 2x3 sub-matrix is a scaled orthographic projection matrix

Definition at line 50 of file m23d_ortho_flexible_builder.h.


The documentation for this class was generated from the following files: