Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRT3D: compute mean probability for region modality #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SRT3D/include/srt3d/region_modality.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class RegionModality {
bool imshow_result() const;
bool set_up() const;

float probability_;

private:
// Helper methods for precalculation of internal data
void PrecalculateFunctionLookup();
Expand Down
5 changes: 5 additions & 0 deletions SRT3D/src/region_modality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ bool RegionModality::CalculatePoseUpdate(int corr_iteration,
gradient.setZero();
hessian.setZero();

probability_ = 0;
// Iterate over correspondence lines
for (auto &data_line : data_lines_) {
// Calculate point coordinates in camera frame
Expand Down Expand Up @@ -356,9 +357,13 @@ bool RegionModality::CalculatePoseUpdate(int corr_iteration,
ddelta_cs_dtheta /= data_line.standard_deviation;
hessian.triangularView<Eigen::Lower>() -=
ddelta_cs_dtheta.transpose() * ddelta_cs_dtheta;

probability_ += data_line.distribution[distribution_length_plus_1_half_];
}
hessian = hessian.selfadjointView<Eigen::Lower>();

probability_ /= std::max(int(data_lines_.size()), 1); // mean probability

// Optimize and update pose
Eigen::FullPivLU<Eigen::Matrix<float, 6, 6>> lu{tikhonov_matrix_ - hessian};
if (lu.isInvertible()) {
Expand Down