Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
unlclearness committed Apr 9, 2019
1 parent f1ab9ce commit b381b9b
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/vacancy/voxel_carver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ bool VoxelGrid::Init(const Eigen::Vector3f& bb_max,

float offset = resolution_ * 0.5f;

const float min_dist =
std::numeric_limits<float>::lowest(); // std::max(std::max(diff[0],
// diff[1]), diff[2]);

const float min_dist = std::numeric_limits<float>::lowest();
#if defined(_OPENMP) && defined(VACANCY_USE_OPENMP)
#pragma omp parallel for schedule(dynamic, 1)
#endif
Expand Down Expand Up @@ -356,21 +353,23 @@ bool VoxelCarver::Carve(const Camera& camera, const Image1b& silhouette,
continue;
}

if (voxel->update_num < 1) {
voxel->sdf = dist;
voxel->update_num++;
continue;
}

if (option_.update_option.voxel_update == VoxelUpdate::kMax) {
if (dist > voxel->sdf) {
voxel->sdf = dist;
voxel->update_num++;
}
} else if (option_.update_option.voxel_update ==
VoxelUpdate::kWeightedAverage) {
if (voxel->update_num < 1) {
voxel->sdf = dist;
} else {
const float& w = option_.update_option.voxel_update_weight;
const float inv_denom = 1.0f / (w * (voxel->update_num + 1));
voxel->sdf =
(w * voxel->update_num * voxel->sdf + w * dist) * inv_denom;
}
const float& w = option_.update_option.voxel_update_weight;
const float inv_denom = 1.0f / (w * (voxel->update_num + 1));
voxel->sdf =
(w * voxel->update_num * voxel->sdf + w * dist) * inv_denom;
voxel->update_num++;
}
}
Expand Down

0 comments on commit b381b9b

Please sign in to comment.