point-cloud-library

how to get length, width and height from Oriented bounding box using pcl library


After obtain OBB box from pointcloud. How can I obtain the length, width and height from OBB box. Any suggestions.

pcl::MomentOfInertiaEstimation<pcl::PointXYZ> feature_extractor;
        feature_extractor.setInputCloud(cloud);
        feature_extractor.compute();
        feature_extractor.getOBB(obb.min_pt, obb.max_pt, obb.position, obb.rotation);
        Eigen::Vector3f masscnt;
        feature_extractor.getMassCenter(masscnt);

Thanks.


Solution

  • You can calculate the side lengths of the oriented bounding box as std::abs(obb.max_pt.x-obb.min_pt.x) and std::abs(obb.max_pt.y-obb.min_pt.y) and std::abs(obb.max_pt.z-obb.min_pt.z).