-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ not reading depth data from .bag file #5667
Comments
@SB11416158 hello, Additionally, when running non real-time playback you can correlate the depth data obtained with the frame index and check whether the results obtained with python and c++ are consistent. |
Hi @ev-mp , Thank you for your reply and suggestions. You're right I am only trying on one frame. Over the whole image all depth values on C++ are 0 but in Python I get depth values. I have tried over several consecutive frames with the same result. C++ always gives a 0 depth value while Python gives proper depth values. |
@SB11416158 , The python code is a wrapper for the functions you call in C++ code, so the definition can't explain the results. On the contrary - in case of discrepancy it is more likely that the C++data becomes corrupted/zeroed when converted to Python but not the other way around. The first thing to check is whether you get the same depth frame continuously in
Print out the frame attributes, such as timestamp and frame number for verification. Also - please check that the realtime flag value is identical. Additionally - try to replay the file using |
Hi @ev-mp , thanks for your response. I checked the time stamp and frame number and they are changing. I compared the timestamp and frame number for the same .bag file in C++ and Python and for the same frame number they have different timestamps. I downloaded the stairs.bag from realsense and ran this. All C++, Python and the realsense viewer are able to read the depth values from the stairs.bag file. Perhaps I am making an error in the way I am saving my .bag files? |
@SB11416158 , can you share the .bag for review? Also put a nullptr check for the result of |
Hi @ev-mp , I added the nullptr check and neither are showing an error, so both C++ and Python are getting the depth frame. |
@SB11416158 thank you for the references provided. |
Hi @ev-mp , |
@SB11416158 , sorry for the delay- I checked both the bag files provided several days ago and they were both correct. I managed to replay both the single frame and the longer records. Just to confirm - did you read the zero values for the central pixel in both bag files, or only the shorter one? config.enable_device_from_file('/plant.bag',repeat_playback=False)
profile = pipe.start(config)
playback = profile.get_device().as_playback()
playback.set_real_time(False) see #5107. Additionally you can verify it by setting the
|
Hi @ev-mp , To confirm, I have recorded .bag files using a Python script. I have tried your suggestions of setting the realtime playback flag to false but still in C++ I have zero depth for all pixels |
Hi. Will you be needing further help with this? The fact that we can successfully run the bag files you provided suggests this is not a librealsense issue. If we don’t hear from you in 7 days, this issue will be closed. Thanks |
|---------------------------------|------------------------------------------- |
| Camera Model | D435 |
| Firmware Version | 05.11.06.250 |
| Operating System & Version | Win 10 |
| Platform | PC |
| SDK Version | 2 |
| Language | C++ / Python |
Issue Description:
I am using a D435 camera to record a .bag file and later using this recorded file to create point clouds. When I am reading in the .bag in C++ all the depth values are 0. However if I read in the same .bag in Pyhton it has all the correct depth values. I need to use C++ but I can't get the depth values from the file. Below are short copies of both codes:
C++:
C++ result: "Distance at centre is 0 meters."
Python:
Python result: "Distance at centre is 0.45600003004074097 meters.."
The text was updated successfully, but these errors were encountered: