8 #include "cvb/point_cloud_factory.hpp" 9 #include "cvb/point_cloud.hpp" 10 #include "cvb/calibrator_3d.hpp" 12 Cvb::Plane3D CutAqs12RoofAndCalculateNormal(
const Cvb::PointCloud& cloud,
double zRangeRoof,
double xRangeRoofPlane,
double yRangeRoofPlane);
18 auto path = Cvb::InstallPath();
22 auto calibrator = Cvb::Calibrator3D::Load<Cvb::Calibrator3D>(path + CVB_LIT(
"tutorial/Metric/Images/SICalibration.json"));
23 calibrator->SetRangeMapIgnoreValue(0.0);
24 auto cloudAqs12 = Cvb::PointCloudFactory::Create<Cvb::DensePointCloud>(rangemap->Plane(0), *calibrator,
29 auto plane = CutAqs12RoofAndCalculateNormal(*cloudAqs12, 10.0, 50.0, 1000.0);
40 Cvb::Plane3D CutAqs12RoofAndCalculateNormal(
const Cvb::PointCloud &cloud,
double zRangeRoof,
double xRangeRoofPlane,
double yRangeRoofPlane)
42 auto dx = xRangeRoofPlane / 2;
43 auto dy = yRangeRoofPlane / 2;
47 bbRoof.
SetZRange({ bbRoof.ZRange().Max() - zRangeRoof, bbRoof.ZRange().Max() + 1 });
48 auto roof = cloud.
Crop(bbRoof);
51 auto cog = roof->CalculateCenterOfGravity();
52 auto bbRoofPlane = roof->CalculateBoundingBox();
53 bbRoofPlane.SetXRange({ cog.X() - dx, cog.X() + dx });
54 bbRoofPlane.SetYRange({ cog.Y() - dy, cog.Y() + dy });
55 auto roofPlane = roof->Crop(bbRoofPlane);
58 return roof->FitPlane();
std::shared_ptr< T > Crop(const Cuboid &clipBox) const
Creates a new point cloud which only consists of the points inside the clip box.
Definition: decl_point_cloud.hpp:301
static std::unique_ptr< Image > Load(const String &fileName)
Loads an image with the given file name.
Definition: detail_image.hpp:32
A point cloud object.
Definition: decl_point_cloud.hpp:48
void SetZRange(ValueRange< double > zRange) noexcept
Set the range regarding the z-axis.
Definition: cuboid.hpp:101
A plane in 3D space in Hessian normal form.
Definition: plane_3d.hpp:17
Cuboid CalculateBoundingBox() const
Calculates the minimum and maximum extent of the point cloud.
Definition: decl_point_cloud.hpp:224