Software Archive
Read-only legacy content
17061 Discussions

Distance between camera and the Closest detected Object or Blob?

Somesh_N_
Novice
738 Views

Hi,

I'm using blob detection in my project which works great. Now, I need to find the distance of the blobs or objects close to the camera. Is there a way I can obtain this information?

I do not want to use distance information from hand tracking modules because it first needs to detect hands which becomes a problem. Blob detection is more spontaneous , and hence I'm looking for someway to find the distance of any given object/ blob close to the camera from the camera itself.

Any help would be greatly appreciated.

Thanks!

0 Kudos
3 Replies
Pubudu-Silva_Intel
738 Views

Blobs help you more in segmentation aspects rather than depth, How ever you can get the image coordinates of the closest point of the blob using the following structure (refer to the manual)

struct BlobData {

  PXCPointI32  closestPoint;

  PXCPointI32  leftPoint;

  PXCPointI32  rightPoint;

  PXCPointI32  topPoint;

  PXCPointI32  bottomPoint;

  PXCPointF32  centerPoint;

   pxcI32       pixelCount;

};

 

Again the manual provides you an alternative hand tracking solution, please search the manual for that

 

 

0 Kudos
Somesh_N_
Novice
738 Views

Hi,

Thanks for the response. I have experimented with BlobData structure. The only problem is, there is no property to find the z coordinate distance.

I want to refrain from using the Hand tracking module for the current purpose due to certain constraints. Is there a way to obtain the distance of an object from the camera  using depth streams?

Please help me out.

Thanks again!

 

0 Kudos
samontab
Valued Contributor II
738 Views

Yes.

Get the depth image, and then use QueryVertices, which is a part of PXCProjection:

    /** 
        @brief Retrieve the vertices for the specific depth image. The vertices is a PXCPoint3DF32 array of depth 
        size width*height. The world coordiantes units are in mm.
        @param[in]  depth        The depth image instance.
        @param[out] vertices     The 3D vertices in World coordinates, to be returned.
        @return PXC_STATUS_NO_ERROR Successful execution.
    */ 
    virtual pxcStatus PXCAPI QueryVertices(PXCImage *depth, PXCPoint3DF32 *vertices)=0;

 

0 Kudos
Reply