I am currently using the following code to obtain 3D data from pixel data using the ZED2 SDK. However, I am encountering an issue where the 3D data sometimes contains NaN values, especially when capturing human poses or other objects. How can I obtain more stable 3D point cloud data from the ZED2 SDK for accurate representation of human poses or other objects without encountering NaN values?
sl::float3 pix_pcl(int pix_x, int pix_y, sl::Mat &point_cloud)
{
sl::float4 point_cloud_value;
point_cloud.getValue(pix_x, pix_y, &point_cloud_value);
if (std::isfinite(point_cloud_value.x) && std::isfinite(point_cloud_value.y) && std::isfinite(point_cloud_value.z))
{
sl::float3 pcl;
pcl.x = point_cloud_value.x;
pcl.y = point_cloud_value.y;
pcl.z = point_cloud_value.z;
return pcl;
}
else
{
sl::float3 pcl;
pcl.x = 0.0;
pcl.y = 0.0;
pcl.z = 0.0;
return pcl;
}
}