mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 01:48:31 +00:00
gui: add SLAM Stereo option to calibrate gui
This commit is contained in:
parent
17034f0283
commit
683dc4ea56
|
@ -427,6 +427,7 @@ u_config_json_save_calibration(struct u_config_json *json, struct xrt_settings_t
|
||||||
switch (settings->camera_type) {
|
switch (settings->camera_type) {
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO: cJSON_AddStringToObject(t, "camera_type", "regular_mono"); break;
|
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO: cJSON_AddStringToObject(t, "camera_type", "regular_mono"); break;
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS: cJSON_AddStringToObject(t, "camera_type", "regular_sbs"); break;
|
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS: cJSON_AddStringToObject(t, "camera_type", "regular_sbs"); break;
|
||||||
|
case XRT_SETTINGS_CAMERA_TYPE_SLAM: cJSON_AddStringToObject(t, "camera_type", "slam_sbs"); break;
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_PS4: cJSON_AddStringToObject(t, "camera_type", "ps4"); break;
|
case XRT_SETTINGS_CAMERA_TYPE_PS4: cJSON_AddStringToObject(t, "camera_type", "ps4"); break;
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_LEAP_MOTION: cJSON_AddStringToObject(t, "camera_type", "leap_motion"); break;
|
case XRT_SETTINGS_CAMERA_TYPE_LEAP_MOTION: cJSON_AddStringToObject(t, "camera_type", "leap_motion"); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,9 @@ enum xrt_settings_camera_type
|
||||||
{
|
{
|
||||||
XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO = 0,
|
XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO = 0,
|
||||||
XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS = 1, // side-by-side
|
XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS = 1, // side-by-side
|
||||||
XRT_SETTINGS_CAMERA_TYPE_PS4 = 2,
|
XRT_SETTINGS_CAMERA_TYPE_SLAM = 2,
|
||||||
XRT_SETTINGS_CAMERA_TYPE_LEAP_MOTION = 3,
|
XRT_SETTINGS_CAMERA_TYPE_PS4 = 3,
|
||||||
|
XRT_SETTINGS_CAMERA_TYPE_LEAP_MOTION = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define XRT_SETTINGS_CAMERA_NAME_LENGTH 256
|
#define XRT_SETTINGS_CAMERA_NAME_LENGTH 256
|
||||||
|
|
|
@ -232,7 +232,7 @@ scene_render_select(struct gui_scene *scene, struct gui_program *p)
|
||||||
igBegin("Params", NULL, 0);
|
igBegin("Params", NULL, 0);
|
||||||
|
|
||||||
igComboStr("Type", (int *)&cs->settings->camera_type,
|
igComboStr("Type", (int *)&cs->settings->camera_type,
|
||||||
"Regular Mono\0Regular Stereo (Side-by-Side)\0PS4\0Leap Motion Controller\0\0", -1);
|
"Regular Mono\0Regular Stereo (Side-by-Side)\0SLAM Stereo\0PS4\0Leap Motion Controller\0\0", -1);
|
||||||
|
|
||||||
switch (cs->settings->camera_type) {
|
switch (cs->settings->camera_type) {
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO:
|
case XRT_SETTINGS_CAMERA_TYPE_REGULAR_MONO:
|
||||||
|
@ -243,6 +243,10 @@ scene_render_select(struct gui_scene *scene, struct gui_program *p)
|
||||||
igCheckbox("Fisheye Camera", &cs->params.use_fisheye);
|
igCheckbox("Fisheye Camera", &cs->params.use_fisheye);
|
||||||
cs->params.stereo_sbs = true;
|
cs->params.stereo_sbs = true;
|
||||||
break;
|
break;
|
||||||
|
case XRT_SETTINGS_CAMERA_TYPE_SLAM:
|
||||||
|
igCheckbox("Fisheye Camera", &cs->params.use_fisheye);
|
||||||
|
cs->params.stereo_sbs = true;
|
||||||
|
break;
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_PS4:
|
case XRT_SETTINGS_CAMERA_TYPE_PS4:
|
||||||
cs->params.use_fisheye = false;
|
cs->params.use_fisheye = false;
|
||||||
cs->params.stereo_sbs = true;
|
cs->params.stereo_sbs = true;
|
||||||
|
@ -337,7 +341,17 @@ scene_render_select(struct gui_scene *scene, struct gui_program *p)
|
||||||
u_sink_quirk_create(cs->xfctx, cali, &qp, &cali);
|
u_sink_quirk_create(cs->xfctx, cali, &qp, &cali);
|
||||||
|
|
||||||
// Now that we have setup a node graph, start it.
|
// Now that we have setup a node graph, start it.
|
||||||
xrt_fs_stream_start(cs->xfs, cali, XRT_FS_CAPTURE_TYPE_CALIBRATION, cs->settings->camera_mode);
|
|
||||||
|
if (cs->settings->camera_type == XRT_SETTINGS_CAMERA_TYPE_SLAM) {
|
||||||
|
struct xrt_frame_sink *tmp = cali;
|
||||||
|
struct xrt_slam_sinks sinks;
|
||||||
|
u_sink_combiner_create(cs->xfctx, tmp, &sinks.left, &sinks.right);
|
||||||
|
|
||||||
|
xrt_fs_slam_stream_start(cs->xfs, &sinks);
|
||||||
|
} else {
|
||||||
|
xrt_fs_stream_start(cs->xfs, cali, XRT_FS_CAPTURE_TYPE_CALIBRATION, cs->settings->camera_mode);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
gui_scene_delete_me(p, &cs->base);
|
gui_scene_delete_me(p, &cs->base);
|
||||||
#endif
|
#endif
|
||||||
|
@ -426,6 +440,7 @@ gui_scene_calibrate(struct gui_program *p,
|
||||||
cs->params.stereo_sbs = true;
|
cs->params.stereo_sbs = true;
|
||||||
cs->settings->camera_type = XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS;
|
cs->settings->camera_type = XRT_SETTINGS_CAMERA_TYPE_REGULAR_SBS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
gui_scene_push_front(p, &cs->base);
|
gui_scene_push_front(p, &cs->base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ static ImVec2 button_dims = {256 + 64, 0};
|
||||||
|
|
||||||
#ifdef XRT_BUILD_DRIVER_DEPTHAI
|
#ifdef XRT_BUILD_DRIVER_DEPTHAI
|
||||||
static void
|
static void
|
||||||
create_depthai(struct video_select *vs)
|
create_depthai_monocular(struct video_select *vs)
|
||||||
{
|
{
|
||||||
vs->xfctx = U_TYPED_CALLOC(struct xrt_frame_context);
|
vs->xfctx = U_TYPED_CALLOC(struct xrt_frame_context);
|
||||||
|
|
||||||
|
@ -64,6 +64,24 @@ create_depthai(struct video_select *vs)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xrt_fs_enumerate_modes(vs->xfs, &vs->modes, &vs->num_modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_depthai_stereo(struct video_select *vs)
|
||||||
|
{
|
||||||
|
vs->xfctx = U_TYPED_CALLOC(struct xrt_frame_context);
|
||||||
|
|
||||||
|
vs->xfs = depthai_fs_stereo_grayscale(vs->xfctx);
|
||||||
|
if (vs->xfs == NULL) {
|
||||||
|
U_LOG_E("Failed to open DepthAI camera!");
|
||||||
|
free(vs->xfctx);
|
||||||
|
vs->xfctx = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vs->settings->camera_type = XRT_SETTINGS_CAMERA_TYPE_SLAM;
|
||||||
|
|
||||||
|
|
||||||
xrt_fs_enumerate_modes(vs->xfs, &vs->modes, &vs->num_modes);
|
xrt_fs_enumerate_modes(vs->xfs, &vs->modes, &vs->num_modes);
|
||||||
}
|
}
|
||||||
#endif /* XRT_BUILD_DRIVER_DEPTHAI */
|
#endif /* XRT_BUILD_DRIVER_DEPTHAI */
|
||||||
|
@ -128,8 +146,11 @@ scene_render(struct gui_scene *scene, struct gui_program *p)
|
||||||
|
|
||||||
#ifdef XRT_BUILD_DRIVER_DEPTHAI
|
#ifdef XRT_BUILD_DRIVER_DEPTHAI
|
||||||
igSeparator();
|
igSeparator();
|
||||||
if (igButton("DepthAI", button_dims)) {
|
if (igButton("DepthAI (Monocular)", button_dims)) {
|
||||||
create_depthai(vs);
|
create_depthai_monocular(vs);
|
||||||
|
}
|
||||||
|
if (igButton("DepthAI (Stereo)", button_dims)) {
|
||||||
|
create_depthai_stereo(vs);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (vs->num_modes == 0) {
|
} else if (vs->num_modes == 0) {
|
||||||
|
|
|
@ -214,6 +214,11 @@ p_factory_ensure_frameserver(struct p_factory *fact)
|
||||||
qp.ps4_cam = false;
|
qp.ps4_cam = false;
|
||||||
qp.leap_motion = false;
|
qp.leap_motion = false;
|
||||||
break;
|
break;
|
||||||
|
case XRT_SETTINGS_CAMERA_TYPE_SLAM:
|
||||||
|
qp.stereo_sbs = true;
|
||||||
|
qp.ps4_cam = false;
|
||||||
|
qp.leap_motion = false;
|
||||||
|
break;
|
||||||
case XRT_SETTINGS_CAMERA_TYPE_PS4:
|
case XRT_SETTINGS_CAMERA_TYPE_PS4:
|
||||||
qp.stereo_sbs = true;
|
qp.stereo_sbs = true;
|
||||||
qp.ps4_cam = true;
|
qp.ps4_cam = true;
|
||||||
|
|
Loading…
Reference in a new issue