Depth Sensing sl::MEM::GPU

Hi,

Tutorial shows how to retrive depth value like below;

        int x = image.getWidth() / 2;
        int y = image.getHeight() / 2;
        sl::float4 point_cloud_value;
        point_cloud_d.getValue(x, y, &point_cloud_value);

        max_z = std::max(max_z, point_cloud_value.z);
        min_z = std::min(min_z, point_cloud_value.z);

this is work but I want to check every pixel so I iterate like;

        for (int y = 0; y < point_cloud_d.getHeight(); ++y)
        {
            for (int x = 0; x < point_cloud_d.getWidth(); ++x)
            {
                sl::float4 point_cloud_value;

                // Retrieve the value at a specific pixel
                if (point_cloud_d.getValue(x, y, &point_cloud_value) == sl::ERROR_CODE::SUCCESS)
                {
                    // Check if the point is valid (not NaN)
                    if (!std::isnan(point_cloud_value.z))
                    {
                        max_z = std::max(max_z, point_cloud_value.z);
                        min_z = std::min(min_z, point_cloud_value.z);
                    }
                }
            }
        }

this return 0 or inf for all z point

Should i follow different approach for depth value reaching mechanism when using MEM::GPU vs default one

Can I traverse on map x,y,z value when it is being constructed with zed.retrieveSpatialMapAsync(map) cant get correct values with .getBoundries()

Hi @davide,

This is typically a use case where you are performing computations on the CPU, so you need to copy the sl::Mat on the CPU before accessing it. This can be done with Mat.updateCPUfromGPU().

As for the sl::Mesh or sl::FusedPointCloud objects, these are unstructured representations of points in 3D, therefore they are not traversable in IMAGE or WORLD coordinates.
You can iterate over the list of vertices of a mesh.