Skip to content

Commit

Permalink
moved proj. jacobian out of loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfo committed Jun 27, 2014
1 parent d6da40f commit ec351f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions svo/src/sparse_img_align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ void SparseImgAlign::precomputeReferencePatches()
const double depth(((*it)->point->pos_ - ref_pos).norm());
const Vector3d xyz_ref((*it)->f*depth);

// evaluate projection jacobian
Matrix<double,2,6> frame_jac;
Frame::jacobian_xyz2uv(xyz_ref, frame_jac);

// compute bilateral interpolation weights for reference image
const float subpix_u_ref = u_ref-u_ref_i;
const float subpix_v_ref = v_ref-v_ref_i;
Expand All @@ -131,10 +135,6 @@ void SparseImgAlign::precomputeReferencePatches()
float dy = 0.5f * ((w_ref_tl*ref_img_ptr[stride] + w_ref_tr*ref_img_ptr[1+stride] + w_ref_bl*ref_img_ptr[stride*2] + w_ref_br*ref_img_ptr[stride*2+1])
-(w_ref_tl*ref_img_ptr[-stride] + w_ref_tr*ref_img_ptr[1-stride] + w_ref_bl*ref_img_ptr[0] + w_ref_br*ref_img_ptr[1]));

// evaluate jacobian and cache
Matrix<double,2,6> frame_jac;
Frame::jacobian_xyz2uv(xyz_ref, frame_jac);

// cache the jacobian
jacobian_cache_.col(feature_counter*patch_area_ + pixel_counter) =
(dx*frame_jac.row(0) + dy*frame_jac.row(1))*(focal_length / (1<<level_));
Expand Down

0 comments on commit ec351f4

Please sign in to comment.