Skip to content

Commit

Permalink
one last segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
Randall Smith committed Apr 11, 2017
1 parent c84384e commit fd4e2ba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

# Set C++ flags.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations -g \
-fsanitize=address -fno-omit-frame-pointer")
"${CMAKE_CXX_FLAGS} -std=c++11 -O3")

# Set the module path (mainly for FindXXX.cmake files)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
Expand Down
8 changes: 8 additions & 0 deletions buildit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [ ! -e build ]
then
mkdir build
fi
cd build
cmake ..
make -j8 $1
10 changes: 9 additions & 1 deletion spectral_saliency.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,24 @@ void ComputeMultiScaleSaliency(const Mesh &mesh, int max_faces,
ComputeMeshSaliency(vertices2, decimated_mesh.faces, saliency2);
// Compute S'(i, t) = |S(i, k(i) * t) - S(i, t)|.
Eigen::VectorXd saliency_t = (saliency2 - saliency1).cwiseAbs();
LOG(DEBUG) << "ComputeMultiScaleSaliency: #saliency1 = "
<< saliency1.rows() << " #saliency2 = " << saliency2.rows()
<< "\n";
LOG(DEBUG) << "ComputeMultiScaleSaliency: reproject saliency.\n";
LOG(DEBUG) << "ComputeMultiScaleSaliency: #saliency = " << saliency.rows()
<< "\n";

// Obtain S(v, t) by method in 3.3.
// For each vertex v in M, find closest point in simplified decimated_mesh
// M', and map the saliency of that point to S(v, t).
for (int j = 0; j < mesh.vertices.rows(); ++j) {
const PclPoint &input_point = input_cloud->points[j];
PclPoint input_point = EigenToPclPoint(mesh.vertices.row(j));
std::vector<int> neighbor_indices;
std::vector<float> neighbor_distances;
tree->nearestKSearch(input_point, 1, neighbor_indices,
neighbor_distances);
assert(neighbor_indices[0] >= 0 &&
neighbor_indices[0] < saliency_t.rows());
// Sum into the current saliency value.
saliency(j) += saliency_t(neighbor_indices[0]);
}
Expand Down Expand Up @@ -352,6 +359,7 @@ int main(int argc, char *argv[]) {

LOG(DEBUG) << "Compute saliency.\n";
ComputeMultiScaleSaliency(mesh, max_vertices, scales, num_scales, saliency);
LOG(DEBUG) << "Compute jet colors.\n";
igl::jet(saliency, saliency.minCoeff(), saliency.maxCoeff(), mesh.colors);
LOG(DEBUG) << "#mesh.colors() = " << mesh.colors.rows() << "\n";

Expand Down

0 comments on commit fd4e2ba

Please sign in to comment.