@@ -17,53 +17,54 @@ namespace albatross {
1717
1818template <typename GroupKey>
1919inline typename RansacFunctions<ConditionalFit, GroupKey>::FitterFunc
20- get_gp_ransac_fitter (const ConditionalGaussian &model,
20+ get_gp_ransac_fitter (const std::shared_ptr< ConditionalGaussian> &model,
2121 const GroupIndexer<GroupKey> &indexer) {
2222
2323 return [&, model, indexer](const std::vector<GroupKey> &groups) {
2424 auto indices = indices_from_groups (indexer, groups);
25- return model. fit_from_indices (indices);
25+ return model-> fit_from_indices (indices);
2626 };
2727}
2828
2929template <typename IsValidCandidateMetric, typename GroupKey>
3030inline typename RansacFunctions<ConditionalFit, GroupKey>::IsValidCandidate
31- get_gp_ransac_is_valid_candidate (const ConditionalGaussian &model,
32- const GroupIndexer<GroupKey> &indexer,
33- const IsValidCandidateMetric &metric) {
31+ get_gp_ransac_is_valid_candidate (
32+ const std::shared_ptr<ConditionalGaussian> &model,
33+ const GroupIndexer<GroupKey> &indexer,
34+ const IsValidCandidateMetric &metric) {
3435
3536 return [&, model, indexer](const std::vector<GroupKey> &groups) {
3637 const auto indices = indices_from_groups (indexer, groups);
37- const auto prior = model. get_prior (indices);
38- const auto truth = model. get_truth (indices);
38+ const auto prior = model-> get_prior (indices);
39+ const auto truth = model-> get_truth (indices);
3940 return metric (prior, truth);
4041 };
4142}
4243
4344template <typename InlierMetricType, typename GroupKey>
4445inline typename RansacFunctions<ConditionalFit, GroupKey>::InlierMetric
45- get_gp_ransac_inlier_metric (const ConditionalGaussian &model,
46+ get_gp_ransac_inlier_metric (const std::shared_ptr< ConditionalGaussian> &model,
4647 const GroupIndexer<GroupKey> &indexer,
4748 const InlierMetricType &metric) {
4849
4950 return [&, indexer, model](const GroupKey &group, const ConditionalFit &fit) {
5051 const auto indices = indexer.at (group);
51- const auto pred = get_prediction_reference ( model, fit, indices);
52- const auto truth = model. get_truth (indices);
52+ const auto pred = make_prediction (* model, fit, indices);
53+ const auto truth = model-> get_truth (indices);
5354 return metric (pred, truth);
5455 };
5556}
5657
5758template <typename ConsensusMetric, typename GroupKey>
5859inline typename RansacFunctions<ConditionalFit, GroupKey>::ConsensusMetric
59- get_gp_ransac_consensus_metric (const ConditionalGaussian &model,
60- const GroupIndexer<GroupKey > &indexer ,
61- const ConsensusMetric &metric) {
60+ get_gp_ransac_consensus_metric (
61+ const std::shared_ptr<ConditionalGaussian > &model ,
62+ const GroupIndexer<GroupKey> &indexer, const ConsensusMetric &metric) {
6263
6364 return [&, model, indexer](const std::vector<GroupKey> &groups) {
6465 const auto indices = indices_from_groups (indexer, groups);
65- const auto prior = model. get_prior (indices);
66- const auto truth = model. get_truth (indices);
66+ const auto prior = model-> get_prior (indices);
67+ const auto truth = model-> get_truth (indices);
6768 return metric (prior, truth);
6869 };
6970}
@@ -120,7 +121,9 @@ inline RansacFunctions<ConditionalFit, GroupKey> get_gp_ransac_functions(
120121 static_assert (is_prediction_metric<InlierMetric>::value,
121122 " InlierMetric must be an PredictionMetric." );
122123
123- const ConditionalGaussian model (std::forward<PriorDistribution>(prior), truth);
124+ const std::shared_ptr<ConditionalGaussian> model =
125+ std::make_shared<ConditionalGaussian>(
126+ std::forward<PriorDistribution>(prior), truth);
124127
125128 const auto fitter = get_gp_ransac_fitter<GroupKey>(model, indexer);
126129
0 commit comments