Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Depth map depth reading

#1
Hi, i am trying to recalculate the ofset from a pixel in the depth map that is created with the function from the example of the Robodk API docs, but i cant convert the grey32 array back to a constistant array of distances, any idea how i can do this?
the code is the same as the example from :https://robodk.com/doc/en/PythonAPI/examples.html#depth-map.


Attached Files Thumbnail(s)
           

.rdk   Test_Simulation.rdk (Size: 14.32 MB / Downloads: 79)
.py   Main_Program_Demo.py (Size: 1.42 KB / Downloads: 67)
#2
I recommend you to take a look at this link for a better example on how to turn image depth information into distances:
https://robodk.com/doc/en/PythonAPI/exam...livestream

In short, you should multiply the int value by the far length distance:
Code:
depth_value = (grey32 / np.iinfo(np.uint32).max) * cam_settings['FAR_LENGTH']
depth_value = depth_value.astype(np.float32)
np.savetxt('C:/Users/username/Desktop/depth_map.txt', depth_value, fmt='%.3f')
I attached a working example.


Attached Files
.py   Main_Program_Demo.py (Size: 2.36 KB / Downloads: 62)
#3
(11-27-2023, 09:06 AM)Albert Wrote: I recommend you to take a look at this link for a better example on how to turn image depth information into distances:
https://robodk.com/doc/en/PythonAPI/exam...livestream

In short, you should multiply the int value by the far length distance:
Code:
depth_value = (grey32 / np.iinfo(np.uint32).max) * cam_settings['FAR_LENGTH']
depth_value = depth_value.astype(np.float32)
np.savetxt('C:/Users/username/Desktop/depth_map.txt', depth_value, fmt='%.3f')
I attached a working example.

This worked out great! Thanks for helping me!
#4
I have a second question that uses the depth map reading. I want to use one of the depth map values and create a point in the robodk simulation. as an example i want to create a point that goes 100mm towards the target. Is there a function to do this? I couldn't find annything online about the calculations that are needed to do this.
#5
There isn't a function to do this. However, you can assume that pixels are evenly spread over the size of the sensor.

The sensor is the rectangular area where the image is projected and it depends on the field of view and the focal length.
  




Users browsing this thread:
1 Guest(s)