Skip to content
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

Reading calibration sometimes results in failure due to unexpected bytes. #12

Open
jbrownkramer opened this issue Nov 1, 2023 · 3 comments
Assignees

Comments

@jbrownkramer
Copy link

Describe the bug
Sometimes when I use pyk4a to get the calibration object from the camera, I get the error 'utf-8' codec can't decode bytes in position 4297-4298: invalid continuation byte

To Reproduce
Run the following code (with appropriate changes to "K4A_DLL_DIR" several times, making sure to restart the python kernel between attempts.

import os
os.environ["K4A_DLL_DIR"] = r"C:\Users\jbrownkramer\projects\OrbbecSDK-K4A-Wrapper\build\bin"
import pyk4a

config = pyk4a.Config(depth_mode = pyk4a.DepthMode.WFOV_2X2BINNED, camera_fps = pyk4a.FPS.FPS_15)
k4a = pyk4a.PyK4A(config)
k4a.start()

print(k4a.calibration_raw)

Expected behavior
Should always return a string with the calibration json.

Logs

Screenshots
image

Desktop (please complete the following information):

  • OS with Version: Windows 11
  • SDK Version: ob/1.8.x
@hzcyf
Copy link
Collaborator

hzcyf commented Nov 3, 2023

Thank you for your feedback. We have not tested pyk4a before. We will arrange time to do a test analysis later to fix the problem you mentioned.

@zzuliys
Copy link
Collaborator

zzuliys commented Nov 9, 2023

@jbrownkramer Hello, we have reproduced the code you provided and did not find any errors. I suggest that you run the code after specifying the Python file encoding format as utf-8. For example, if you encounter any problems at the file header, please feel free to contact us.

@jbrownkramer
Copy link
Author

jbrownkramer commented Nov 13, 2023

Did you try running the code several times? It does not fail every time, so the byte string being returned from the camera is inconsistent.

If you look at the error in the screenshot I provided, you will see that python is attempting to decode the byte string as utf-8 encoded, but failing because the bytes being returned from the camera are (sometimes) not proper utf-8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants