ifm / ifm3d

Library and Utilities for working with ifm pmd-based 3D ToF Cameras
https://api.ifm3d.com
Apache License 2.0
110 stars 69 forks source link

Problems when using lfm3dpy #350

Closed LarsBuck closed 2 years ago

LarsBuck commented 2 years ago

Hello,

so i was experiencing some issues when using the O3D300 Sensor with python ifm3dpy library. My Setup:

Ubuntu 20.04 LTS 5.13.0-30-generic Python 3.8.10 ifm3dpy 0.93.0 ifm3d 0.18.0 installed with snap camera firmware 1.71.xx

The problem:

I was using the example code given on your docs HERE and experienced some errors regarding the .get() and other methods.

importlib._bootstrap.Error: Unknown error 100001: XMLRPC method not found (D-Bus error 16)

Have you experienced the same error before and can help me out with a possible fix ? If you could provide any further examples that would be helpful.

inbangsa commented 2 years ago

Hello @LarsBuck ,

The document you referred is written for O3R device, For O3D/O3X camera please refer to the Usage Example

you mentioned in your issue that you have O3D sensor and not camera. if its sensor then you might need to create a default application on device and make it active to grab the data.

LarsBuck commented 2 years ago

Hi @inbangsa,

thanks for your quick response and pointing out my mistake. Do you have any reference or information on how to create such application for the sensor ?

graugans commented 2 years ago

Hey @LarsBuck please check those examples example-creating-new-applications

LarsBuck commented 2 years ago

Hi,

so i just took a look at the sensor devices via $ ifm3d ls and got the following output

 {
   "Active": true,
   "Description": "",
   "Id": 1571000710,
   "Index": 1,
   "Name": "Advanced application"
 }
]

So i guess there is an active application for my sensor. How exactly do I grab the data from the Sensor ? I ran the example code provided by @inbangsa which will return the amplitude image in form of a numpy array. I then tried to visualize this with the opencv imshow() method, but it will only show a fully black image.

inbangsa commented 2 years ago

@LarsBuck can you help me understand the fully black image, is it all the values in the numpy array are zero OR it might be the values are near to zero and that might cause image to appear black.

LarsBuck commented 2 years ago

The amplitude image holds values out of range

[[1174 1091 1151 ... 591 611 629] [1121 1058 1130 ... 755 718 750] [ 965 974 1161 ... 990 968 989] ... [ 626 638 754 ... 862 746 676] [ 593 581 710 ... 818 715 668] [ 845 785 766 ... 778 719 666]]

I also tried to normalize them into range of 0...255 but without success.

opencv_imshow_ifm

inbangsa commented 2 years ago

@LarsBuck if I look closely I can see the box in Image. The issue here is not with ifm3dpy but its with display.

for amplitude image of O3D3XX each pixel is stored in uint16_t

You can also set the ExposureTime parameter of the device to a higher value which will help to get more dynamic range in the image

inbangsa commented 2 years ago

@LarsBuck this issue looks very similar. Please refer to discussion for scaling and Display of the amplitude image

LarsBuck commented 2 years ago

@inbangsa You are totally right. When multiplying the image with a factor, it now becomes visible.

inbangsa commented 2 years ago

@LarsBuck if problem is resolve can we close this issue.