Flaw with compute3DCentroid and getMinMax3D
Hey everyone, I'm using the "standard" way of creating bounding boxes for a point cloud cluster, which most resources online are using. My code posted below. However it seems there is a flaw here, because as seen in the screenshot, the algorithm seems to shift the bounding box a certain amount too far forward. I'm wondering where the offset is coming from?
visualization_msgs::Marker mark_cluster(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster, int ide)
{
Eigen::Vector4f centroid;
Eigen::Vector4f min;
Eigen::Vector4f max;
pcl::compute3DCentroid (*cloud_cluster, centroid);
pcl::getMinMax3D (*cloud_cluster, min, max);
uint32_t shape = visualization_msgs::Marker::CUBE;
visualization_msgs::Marker marker;
marker.header.frame_id = "laser";
marker.header.stamp = ros::Time::now();
marker.ns = "objects";
marker.id = ide;
marker.type = shape;
marker.action = visualization_msgs::Marker::ADD;
marker.pose.position.x = centroid[0];
marker.pose.position.y = centroid[1];
marker.pose.position.z = centroid[2];
marker.pose.orientation.x = 0.0;
marker.pose.orientation.y = 0.0;
marker.pose.orientation.z = 0.0;
marker.pose.orientation.w = 1.0;
marker.scale.x = (max[0]-min[0]);
marker.scale.y = (max[1]-min[1]);
marker.scale.z = (max[2]-min[2]);
...
hello can i get the full version of your code ?
Thank you in advance