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

Use C++11 random generator instead of Boost in RangeLikelihood #2988

Closed
SunBlack opened this issue Apr 10, 2019 · 3 comments
Closed

Use C++11 random generator instead of Boost in RangeLikelihood #2988

SunBlack opened this issue Apr 10, 2019 · 3 comments
Labels
needs: feedback Specify why not closed/merged yet
Milestone

Comments

@SunBlack
Copy link
Contributor

Currently there is some Boost code, because pdf/cdf has no direct equivalent in C++14.

using boost::math::normal; // typedef provides default type is double.
normal unit_norm_dist(0,1); // (default mean = zero, and standard deviation = unity)
double costFunction5(double measured_depth, double model_disp, double sigma, double floor_proportion)
{
// NEED TO CONVERT MEASURED TO DISPARITY
double measured_disp = (-0.7253/measured_depth + 1.0360 );
// measured_depth = ref_val [m]
// model_disp = depth_val [0-1]
// upper and lower bound on depth buffer:
double lower_bound =0;
double upper_bound =1;
double gaussian_part = pdf(unit_norm_dist, (measured_disp-model_disp)/sigma)/sigma;
double truncation = 1/cdf(unit_norm_dist,(upper_bound-model_disp)/sigma) - cdf(unit_norm_dist, (lower_bound-model_disp)/sigma);
double trunc_gaussian_part = truncation*gaussian_part;
double lhood= (floor_proportion/(upper_bound-lower_bound) + (1-floor_proportion)*trunc_gaussian_part);
if (measured_depth< 0){ // all images pixels with no range
lhood = 1; // log(1) = 0 ---> has no effect
}
return log (lhood);
}

@stale
Copy link

stale bot commented Jun 6, 2020

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the status: stale label Jun 6, 2020
@kunaltyagi
Copy link
Member

@Morwenn We should close this issue, right? Based on the discussions before, using boost distributions provides better reproducibility.

@stale stale bot removed the status: stale label Jun 7, 2020
@kunaltyagi kunaltyagi added the needs: feedback Specify why not closed/merged yet label Jun 7, 2020
@Morwenn
Copy link
Contributor

Morwenn commented Jun 7, 2020

Apparently the Boost components in RangeLikelihood have already been replaced by std:: ones a year ago, so the issue should have been closed regardless. If you want to rollback the distribution to the Boost one, I guess that it can be done as part of #3996 or a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: feedback Specify why not closed/merged yet
Projects
None yet
Development

No branches or pull requests

3 participants