41 int main(
int argc,
char** argv)
44 pcl::PointCloud<pcl::PointNormal>
cloud;
45 for (
double x = -2;
x < 2;
x += 0.01) {
46 for (
double y = -2;
y < 2;
y += 0.01) {
55 ann_grid->build(
cloud);
57 ann_grid->toImage(grid_image);
58 std::cout <<
"ann grid size is "
59 << grid_image.rows <<
"x" << grid_image.cols << std::endl;
60 cv::imshow(
"ann_grid", grid_image);
63 ANNGrid::IndexArray pixels = ann_grid->bresenham(Eigen::Vector3f(1, 1, 0), Eigen::Vector3f(-1, -1, 0));
64 ann_grid->toImage(grid_image2, pixels);
65 cv::imshow(
"ann_grid2", grid_image2);
69 Eigen::Vector3f(-1, 1, 0),
70 Eigen::Vector3f(-1, -1, 0),
71 Eigen::Vector3f(1, -1, 0));
72 ann_grid->toImage(grid_image3, box_pixels);
73 cv::imshow(
"ann_grid3", grid_image3);
77 Eigen::Vector3f(-1, 1, 0),
78 Eigen::Vector3f(-1, -1, 0),
79 Eigen::Vector3f(1, -1, 0));
80 std::cout <<
"filled pixels: " << filled_pixels.size() << std::endl;
81 ann_grid->toImage(grid_image4, filled_pixels);
82 cv::imshow(
"ann_grid4", grid_image4);
84 pcl::PointIndices near_indices;
85 ann_grid->approximateSearchInBox(Eigen::Vector3f(1, 1, 0),
86 Eigen::Vector3f(-1, 1, 0),
87 Eigen::Vector3f(-1, -1, 0),
88 Eigen::Vector3f(1, -1, 0),
90 for (
size_t i = 0;
i < near_indices.indices.size();
i++) {
91 std::cout <<
cloud.points[near_indices.indices[
i]] << std::endl;