The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/util: Add "reinterpret bayer format as l8" quirk

This is useful for when cameras expose raw bayer formats, and the on-device debayering does a bad job when the image is later converted to greyscale, such as for tracking fiducial markers, or doing camera calibration with a checkerboard.

This was added for the PlayStation Eye camera, which has really poor debayering, and doing this reinterpret trick helps get more acurate calibrations and fiducial tracking.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2540>

authored by

Beyley Cardellio and committed by
Marge Bot
6047cb25 6a9386eb

+17 -9
+8
src/xrt/auxiliary/util/u_sink.h
··· 26 26 */ 27 27 struct u_sink_quirk_params 28 28 { 29 + //! Marks frames passing through as side-by-side stereo. 29 30 bool stereo_sbs; 31 + /*! 32 + * Marks the frames passing through as side-by-side stereo, and fixes up the camera's data offset to be readable 33 + * as a standard side-by-side frame. 34 + */ 30 35 bool ps4_cam; 36 + //! Sets the stereo format to the correct one for the leap motion and fixes image width. 31 37 bool leap_motion; 38 + //! Reinterprets a raw bayer image as a monochrome L8 image. 39 + bool bayer_as_l8; 32 40 }; 33 41 34 42 /*!
+9 -9
src/xrt/auxiliary/util/u_sink_quirk.c
··· 23 23 struct xrt_frame_sink *downstream; 24 24 struct xrt_frame_sink *right; 25 25 26 - bool stereo_sbs; 27 - bool ps4_cam; 28 - bool leap_motion; 26 + struct u_sink_quirk_params params; 29 27 }; 30 28 31 29 static void ··· 36 34 //! @todo this is not thread safe, but right no other thing has access 37 35 //! to the frame (or should). 38 36 39 - if (q->stereo_sbs) { 37 + if (q->params.stereo_sbs) { 40 38 xf->stereo_format = XRT_STEREO_FORMAT_SBS; 41 39 } 42 40 43 - if (q->leap_motion) { 41 + if (q->params.leap_motion) { 44 42 xf->stereo_format = XRT_STEREO_FORMAT_INTERLEAVED; 45 43 xf->format = XRT_FORMAT_L8; 46 44 xf->width *= 2; 47 45 } 48 46 49 - if (q->ps4_cam) { 47 + if (q->params.ps4_cam) { 50 48 // Stereo format. 51 49 xf->stereo_format = XRT_STEREO_FORMAT_SBS; 52 50 ··· 68 66 break; 69 67 default: break; 70 68 } 69 + } 70 + 71 + if (q->params.bayer_as_l8 && xf->format == XRT_FORMAT_BAYER_GR8) { 72 + xf->format = XRT_FORMAT_L8; 71 73 } 72 74 73 75 q->downstream->push_frame(q->downstream, xf); ··· 105 107 q->node.destroy = destroy; 106 108 q->downstream = downstream; 107 109 108 - q->stereo_sbs = params->stereo_sbs; 109 - q->ps4_cam = params->ps4_cam; 110 - q->leap_motion = params->leap_motion; 110 + q->params = *params; 111 111 112 112 xrt_frame_context_add(xfctx, &q->node); 113 113