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.
Extract Coordinates From Depth Camera
-
- Posts: 10
- Joined: 09 Jan 2018, 17:14
Re: Extract Coordinates From Depth Camera
Hello,
Thank you for your reply.
I'm trying to extract the coordinates manually from depth image.
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.
where depth is the intensity - a value between 0 and 1 - of the pixel given by the camera.
It works but sometimes it gives some noise specially when the robot is running.
So, Is there something that I'm doing wrong?
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
- 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)))
- 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 )));
So, Is there something that I'm doing wrong?