opencv/modules/3d/test/test_ptcloud_utils.hpp
Wanli Zhong b06544bd54
Merge pull request #21918 from No-Plane-Cannot-Be-Detected:5.x-region_growing_3d
Add normal estimation and region growing algorithm for point cloud

* Add normal estimation and region growing algorithm for point cloud

* 1.Modified documentation for normal estimation;2.Converted curvature in region growing to absolute values;3.Changed the data type of threshold from float to double;4.Fixed some bugs;

* Finished documentation

* Add tests for normal estimation. Test the normal and curvature of each point in the plane and sphere of the point cloud.

* Fix some warnings caused by to small numbers in test

* Change the test to calculate the average difference instead of comparing each normal and curvature

* Fixed the bugs found by testing

* Redesigned the interface and fixed problems:
1. Make the interface compatible with radius search.
2. Make region growing optionally sortable on results.
3. Modified the region growing interface.
4. Format reference.
5. Removed sphere test.

* Fix warnings

* Remove flann dependency

* Move the flann dependency to the corresponding test
2022-05-23 14:47:57 +00:00

44 lines
1.6 KiB
C++

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2021, Wanli Zhong <zhongwl2018@mail.sustech.edu.cn>
#ifndef OPENCV_TEST_PTCLOUD_UTILS_HPP
#define OPENCV_TEST_PTCLOUD_UTILS_HPP
#include "test_precomp.hpp"
namespace opencv_test {
/**
* @brief Generate a specific plane with random points.
*
* @param[out] plane_pts Point cloud of plane, only support vector<Point3f> or Mat with Nx3 layout
* in memory.
* @param model Plane coefficient [a,b,c,d] means ax+by+cz+d=0.
* @param thr Generate the maximum distance from the point to the plane.
* @param num The number of points.
* @param limit The range of xyz coordinates of the generated plane.
*
*/
void generatePlane(OutputArray plane_pts, const vector<float> &model, float thr, int num,
const vector<float> &limit);
/**
* @brief Generate a specific sphere with random points.
*
* @param[out] sphere_pts Point cloud of plane, only support vector<Point3f> or Mat with Nx3 layout
* in memory.
* @param model Plane coefficient [a,b,c,d] means x^2+y^2+z^2=r^2.
* @param thr Generate the maximum distance from the point to the surface of sphere.
* @param num The number of points.
* @param limit The range of vector to make the generated sphere incomplete.
*
*/
void generateSphere(OutputArray sphere_pts, const vector<float> &model, float thr, int num,
const vector<float> &limit);
} // opencv_test
#endif //OPENCV_TEST_PTCLOUD_UTILS_HPP