I have performed blob detection using opencv using their simple blob detector.
I am using zed sdk apis for getting the depth map
Now i have the centroids
How can I use the centroid pixel coordinates , which are of datatype double along with depth sensing to get the distance of those blobs detected?
Hi @haadinho10,
You can retrieve the image and the depth using zed sdk API (Camera Class Reference | API Reference | Stereolabs and use the VIEW enum to retrieve each one Video Module | API Reference | Stereolabs).
If I understand well your question, you want the depth of a detected object, given its coordinates in the image. To do so, you have to read the depth value at the centroid coordinates in the retrieved depth map.
About the fact you get “double” coordinates, you can chose to get depth value from the nearest pixel, or compute the average depth value for neighbouring pixels. Be careful that the centroid represents well your object (for example, if you have a holed object, it may not work).
Best regards,