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

Converting device controls from k4a to OrbbecSDK #9

Open
Suedocode opened this issue Oct 11, 2024 · 1 comment
Open

Converting device controls from k4a to OrbbecSDK #9

Suedocode opened this issue Oct 11, 2024 · 1 comment
Assignees

Comments

@Suedocode
Copy link
Collaborator

Suedocode commented Oct 11, 2024

Listed device controls from ob_device_control (edited to print current values as well):

------------------------------------------------------------------------
00. OB_PROP_DEPTH_ALIGN_HARDWARE_BOOL(42):	0	permission=R/W, range=Bool value(min:0, max:1, step:1)
01. OB_PROP_TIMESTAMP_OFFSET_INT(43):	0	permission=R/W, range=Int value(min:0, max:0, step:0)
02. OB_PROP_FAN_WORK_MODE_INT(62):	1	permission=R/W, range=Int value(min:0, max:1, step:1)
03. OB_PROP_DEPTH_ALIGN_HARDWARE_MODE_INT(63):	0	permission=R/W, range=Int value(min:0, max:0, step:0)
04. OB_PROP_INDICATOR_LIGHT_BOOL(83):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
05. OB_PROP_HEARTBEAT_BOOL(89):	0	permission=R/W, range=Bool value(min:0, max:1, step:1)
06. OB_PROP_SWITCH_IR_MODE_INT(98):	0	permission=R/W, range=Int value(min:0, max:1, step:1)
07. OB_PROP_TIMER_RESET_SIGNAL_BOOL(104):	EXCPT	permission=_/W, range=Bool value(min:0, max:1, step:1)
08. OB_PROP_USB_POWER_STATE_INT(121):	3	permission=R/_, range=Int value(min:0, max:1, step:1)
09. OB_PROP_DC_POWER_STATE_INT(122):	1	permission=R/_, range=Int value(min:0, max:1, step:1)
10. OB_PROP_BOOT_INTO_RECOVERY_MODE_BOOL(132):	EXCPT	permission=_/W, range=Bool value(min:0, max:1, step:1)
11. OB_PROP_TIMER_RESET_ENABLE_BOOL(140):	0	permission=R/W, range=Bool value(min:0, max:1, step:1)
12. OB_PROP_COLOR_AUTO_EXPOSURE_BOOL(2000):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
13. OB_PROP_COLOR_EXPOSURE_INT(2001):	200	permission=R/W, range=Int value(min:1, max:2000, step:1)
14. OB_PROP_COLOR_EXPOSURE_INT(2001):	200	permission=R/W, range=Int value(min:1, max:2000, step:1)
15. OB_PROP_COLOR_GAIN_INT(2002):	60	permission=R/W, range=Int value(min:1, max:240, step:1)
16. OB_PROP_COLOR_AUTO_WHITE_BALANCE_BOOL(2003):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
17. OB_PROP_COLOR_WHITE_BALANCE_INT(2004):	6500	permission=R/W, range=Int value(min:2000, max:11000, step:100)
18. OB_PROP_COLOR_BRIGHTNESS_INT(2005):	0	permission=R/W, range=Int value(min:0, max:128, step:1)
19. OB_PROP_COLOR_SHARPNESS_INT(2006):	6	permission=R/W, range=Int value(min:1, max:15, step:1)
20. OB_PROP_COLOR_SATURATION_INT(2008):	54	permission=R/W, range=Int value(min:1, max:80, step:1)
21. OB_PROP_COLOR_CONTRAST_INT(2009):	32	permission=R/W, range=Int value(min:1, max:60, step:1)
22. OB_PROP_COLOR_POWER_LINE_FREQUENCY_INT(2015):	2	permission=R/W, range=Int value(min:0, max:2, step:1)
23. OB_PROP_DEPTH_EXPOSURE_INT(2017):	125	permission=R/_, range=Int value(min:20, max:125, step:1)
24. OB_PROP_IR_EXPOSURE_INT(2026):	125	permission=R/_, range=Int value(min:20, max:125, step:1)
25. OB_PROP_SDK_ACCEL_FRAME_TRANSFORMED_BOOL(3009):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
26. OB_PROP_SDK_GYRO_FRAME_TRANSFORMED_BOOL(3010):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
------------------------------------------------------------------------

Notably, props 13 and 14 are identical, but I don't think that's a critical issue. Below is my best guess on control conversions, but a few I'm not sure how to reproduce:

Auto exposure time seems pretty straightforward

//12. OB_PROP_COLOR_AUTO_EXPOSURE_BOOL(2000):	1	permission=R/W, range=Bool value(min:0, max:1, step:1)
k4a_dev.set_color_control(
    K4A_COLOR_CONTROL_EXPOSURE_TIME_ABSOLUTE,
    K4A_COLOR_CONTROL_MODE_AUTO,
    0 //unused I think
    );
orbbec_dev->setBoolProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, 1);

PROBLEM: Manual control over exposure time is unclear to me (k4a exposure mappings, k4a enums). This is also the setting with duplicate index, which I could use clarification on as well. The value for k4a is in microseconds, but orbbec's range limit does not go high enough to replicate the setting value.

//13. OB_PROP_COLOR_EXPOSURE_INT(2001):	200	permission=R/W, range=Int value(min:1, max:2000, step:1)
//14. OB_PROP_COLOR_EXPOSURE_INT(2001):	200	permission=R/W, range=Int value(min:1, max:2000, step:1)
dev.set_color_control(
    K4A_COLOR_CONTROL_EXPOSURE_TIME_ABSOLUTE,
    K4A_COLOR_CONTROL_MODE_MANUAL,
    2500 /*microseconds*/
    ); 
orbbec_dev->setIntProperty(OB_PROP_COLOR_EXPOSURE_INT, /* ?? */); 
orbbec_dev->setBoolProperty(OB_PROP_COLOR_AUTO_EXPOSURE_BOOL, 0);

QUESTION: The gain in the k4a viewer was adjustable to 255, and I wrote this into the k4a settings, but Orbbec says the max range is up to 240. I think that is probably good enough, but I was curious if there was some clarification here on the difference. It's possible k4a simply clamped 255 to 240.

//15. OB_PROP_COLOR_GAIN_INT(2002):	60	permission=R/W, range=Int value(min:1, max:240, step:1)
dev.set_color_control(
    K4A_COLOR_CONTROL_GAIN,
    K4A_COLOR_CONTROL_MODE_MANUAL,
    255 
    );
orbbec_dev->setIntProperty(OB_PROP_COLOR_GAIN_INT, 240); //max is 240 according to Orbbec options

PROBLEM: Backlight compensation exists in OrbbecSDK as OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT(2013), but for some reason it was not listed in my device's properties. The k4a library also has it as a bool type, whereas orbbec lists it as int.

//Setting was not enumerated in device controls!
dev.set_color_control(
    K4A_COLOR_CONTROL_BACKLIGHT_COMPENSATION,
    K4A_COLOR_CONTROL_MODE_MANUAL,
    1   
    );
orbbec_dev->setIntProperty(OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT, 1);

Environment:
Ubuntu 22.04.5 LTS (x86_64)
g++ 11.4.0
OrbbecSDK-dev bd2d4dd
Femto: Firmware v1.2.9

@hzcyf hzcyf self-assigned this Oct 12, 2024
@hzcyf
Copy link
Contributor

hzcyf commented Oct 12, 2024

  1. Props 13 and 14 are identical: it is fixed in the new versions and will be released recently.
  2. The exposure unit for the color sensor in Femto Mega is set at 100 microseconds, as defined by the UVC protocol.
  3. The maximum gain value supported by the Color Sensor of Femto Mega is only 240. We are not using the same Sensor and ISP as the K4A camera, and we are also unsure how Microsoft has implemented this.
  4. The OB_PROP_COLOR_BACKLIGHT_COMPENSATION_INT property is not supported by Femto Mega, as it is intended for use with other device models. In devices that do support this property, the configurable options extend beyond just true and false.

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

2 participants