Page 1 of 1

Extract Coordinates From Depth Camera

Posted: 13 Mar 2018, 22:37
by davicarnauba84
Hello,

How can I extract the coordinates of a single line of the image captured by depth camera. Also, how can I retrieve these coordinates using Java remoteApi?

Bests.

Re: Extract Coordinates From Depth Camera

Posted: 14 Mar 2018, 02:52
by Zhuang
Hi,
i think the answer is helpful for you .
viewtopic.php?f=9&t=7128&p=28171&hilit=zhuang#p28171

Re: Extract Coordinates From Depth Camera

Posted: 14 Mar 2018, 22:24
by davicarnauba84
Hello,

Thank you for your reply.
I'm trying to extract the coordinates manually from depth image.
  • So, first I'm calculating the angle of a pixel relative to the robot using

Code: Select all

angle = ((double)posx/(viewWidth-1))*fov - fov/2
where posx is the position of the pixel in range of 0 to viewWidth-1 and fov is the field of view of the depth camera.
  • The relative distance between the pixel and the camera I'm calculating using:

Code: Select all

distance = (farClippingPlane - nearClippingPlane) * depth + nearClippingPlane
distanceFromCamera = Math.abs(distance/Math.sin(Math.toRadians(angle)))
where depth is the intensity - a value between 0 and 1 - of the pixel given by the camera.
  • and finally the relative position of a pixel I'm calculating using:

Code: Select all

distanceFromCamera*Math.cos(Math.toRadians(angle)),
distanceFromCamera*Math.sin(Math.toRadians(angle )));
It works but sometimes it gives some noise specially when the robot is running.

So, Is there something that I'm doing wrong?