The open source OpenXR runtime

doc: Add json schema for new calibration file

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
0268daff 75d57b58

+326 -2
+9 -1
doc/CMakeLists.txt
··· 34 # request to configure the file 35 configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 36 37 - # copy the schema 38 configure_file( 39 ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json 40 ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json @ONLY ··· 42 configure_file( 43 ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json.license 44 ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json.license @ONLY 45 ) 46 47 # note the option ALL which allows to build the docs together with the application
··· 34 # request to configure the file 35 configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 36 37 + # copy the schemas 38 configure_file( 39 ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json 40 ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json @ONLY ··· 42 configure_file( 43 ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json.license 44 ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json.license @ONLY 45 + ) 46 + configure_file( 47 + ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/calibration_v2.schema.json 48 + ${CMAKE_CURRENT_BINARY_DIR}/html/calibration_v2.schema.json @ONLY 49 + ) 50 + configure_file( 51 + ${CMAKE_CURRENT_SOURCE_DIR}/example_configs/calibration_v2.schema.json.license 52 + ${CMAKE_CURRENT_BINARY_DIR}/html/calibration_v2.schema.json.license @ONLY 53 ) 54 55 # note the option ALL which allows to build the docs together with the application
+90
doc/example_configs/calibration_v2.example.json
···
··· 1 + { 2 + "$schema": "https://monado.pages.freedesktop.org/monado/calibration_v2.schema.json", 3 + "file": { 4 + "version": 2, 5 + "created_on": "2021-11-23T14:33:51Z" 6 + }, 7 + "cameras": [ 8 + { 9 + "name": "Fake Camera 0", 10 + "model": "fisheye_equidistant4", 11 + "intrinsics": { 12 + "fx": 428.485, 13 + "fy": 428.485, 14 + "cx": 423.567, 15 + "cy": 240.114 16 + }, 17 + "distortion": { 18 + "k1": 0, 19 + "k2": 0, 20 + "k3": 0, 21 + "k4": 0 22 + }, 23 + "resolution": { 24 + "width": 848, 25 + "height": 480 26 + } 27 + }, 28 + { 29 + "name": "Fake Camera 1", 30 + "model": "pinhole_radtan5", 31 + "intrinsics": { 32 + "fx": 428.485, 33 + "fy": 428.485, 34 + "cx": 423.567, 35 + "cy": 240.114 36 + }, 37 + "distortion": { 38 + "k1": 0, 39 + "k2": 0, 40 + "p1": 0, 41 + "p2": 0, 42 + "k3": 0 43 + }, 44 + "resolution": { 45 + "width": 848, 46 + "height": 480 47 + } 48 + } 49 + ], 50 + "opencv_stereo_calibrate": { 51 + "rotation": [ 52 + 0.95321815970241375, 53 + 0.0408369712626572, 54 + -0.29951207286457837, 55 + -0.0679705814297339, 56 + 0.99441512328599491, 57 + -0.080737616017587777, 58 + 0.29454225515814791, 59 + 0.097318571496875367, 60 + 0.950670266479477 61 + ], 62 + "translation": [ 63 + 1.4416754185893419, 64 + 1.176208605914552, 65 + -4.208172261903619 66 + ], 67 + "essential": [ 68 + 0.060411219924425982, 69 + 4.2991370799395261, 70 + 0.77842875260280309, 71 + -4.4359405481998833, 72 + -0.31215080202694384, 73 + -0.11015955723326701, 74 + -1.2191749191904835, 75 + 1.385591042076286, 76 + 0.23589124131056205 77 + ], 78 + "fundamental": [ 79 + -2.9769859891445467e-07, 80 + -2.8163083335581391e-05, 81 + -0.0139603067332745, 82 + 1.2138399250016221e-05, 83 + 1.1354810181647868e-06, 84 + -0.0015106776411851692, 85 + 0.0061879358690168085, 86 + 0.0041368502945713613, 87 + 1 88 + ] 89 + } 90 + }
+2
doc/example_configs/calibration_v2.example.json.license
···
··· 1 + Copyright 2021, Collabora, Ltd. 2 + SPDX-License-Identifier: CC0-1.0
+222
doc/example_configs/calibration_v2.schema.json
···
··· 1 + { 2 + "$schema": "http://json-schema.org/draft-07/schema", 3 + "title": "Monado calibration file schema v2", 4 + "type": "object", 5 + "required": [ 6 + "file", 7 + "cameras", 8 + "opencv_stereo_calibrate" 9 + ], 10 + "properties": { 11 + "$schema": { 12 + "type": "string", 13 + "title": "JSON Schema directive", 14 + "default": "https://monado.pages.freedesktop.org/monado/calibration_v2.schema.json" 15 + }, 16 + "file": { 17 + "description": "Calibration file metadata", 18 + "type": "object", 19 + "required": [ 20 + "version" 21 + ], 22 + "properties": { 23 + "version": { 24 + "const": 2 25 + }, 26 + "created_on": { 27 + "$ref": "#/$defs/datetime" 28 + } 29 + } 30 + }, 31 + "cameras": { 32 + "type": "array", 33 + "minItems": 2, 34 + "maxItems": 2, 35 + "description": "Stereo calibrated cameras", 36 + "items": { 37 + "$ref": "#/$defs/camera" 38 + } 39 + }, 40 + "opencv_stereo_calibrate": { 41 + "$ref": "#/$defs/opencv_stereo_calibrate" 42 + } 43 + }, 44 + "$defs": { 45 + "camera": { 46 + "type": "object", 47 + "required": [ 48 + "name", 49 + "model", 50 + "intrinsics", 51 + "distortion", 52 + "resolution" 53 + ], 54 + "properties": { 55 + "name": { 56 + "$ref": "#/$defs/camera_name" 57 + }, 58 + "model": { 59 + "description": "Camera and distortion model", 60 + "enum": [ 61 + "pinhole_radtan5", 62 + "fisheye_equidistant4" 63 + ] 64 + }, 65 + "intrinsics": { 66 + "type": "object", 67 + "required": [ 68 + "fx", 69 + "fy", 70 + "cx", 71 + "cy" 72 + ], 73 + "properties": { 74 + "fx": { 75 + "type": "number" 76 + }, 77 + "fy": { 78 + "type": "number" 79 + }, 80 + "cx": { 81 + "type": "number" 82 + }, 83 + "cy": { 84 + "type": "number" 85 + } 86 + } 87 + }, 88 + "distortion": { 89 + "description": "Parameters for the specified distortion model. radtan5: k1,k2,p1,p2,k3. equidistant4: k1,k2,k3,k4.", 90 + "$comment": "There is no easy way to enforce the fields parameters in the schema based on the `model` property, the if-then validation could help but still would be very cumbersome.", 91 + "oneOf": [ 92 + { 93 + "$ref": "#/$defs/equidistant4" 94 + }, 95 + { 96 + "$ref": "#/$defs/radtan5" 97 + } 98 + ] 99 + }, 100 + "resolution": { 101 + "type": "object", 102 + "required": [ 103 + "width", 104 + "height" 105 + ], 106 + "properties": { 107 + "width": { 108 + "type": "integer" 109 + }, 110 + "height": { 111 + "type": "integer" 112 + } 113 + } 114 + } 115 + } 116 + }, 117 + "camera_name": { 118 + "description": "Display name; not necessarily unique.", 119 + "type": "string", 120 + "maxLength": 128 121 + }, 122 + "opencv_stereo_calibrate": { 123 + "description": "Data produced by cv::stereoCalibrate.", 124 + "type": "object", 125 + "required": [ 126 + "rotation", 127 + "translation", 128 + "essential", 129 + "fundamental" 130 + ], 131 + "additionalProperties": false, 132 + "properties": { 133 + "rotation": { 134 + "$ref": "#/$defs/mat3x3d" 135 + }, 136 + "translation": { 137 + "$ref": "#/$defs/mat3x1d" 138 + }, 139 + "essential": { 140 + "$ref": "#/$defs/mat3x3d" 141 + }, 142 + "fundamental": { 143 + "$ref": "#/$defs/mat3x3d" 144 + } 145 + } 146 + }, 147 + "mat3x3d": { 148 + "type": "array", 149 + "items": { 150 + "type": "number" 151 + }, 152 + "minItems": 9, 153 + "maxItems": 9 154 + }, 155 + "mat3x1d": { 156 + "type": "array", 157 + "items": { 158 + "type": "number" 159 + }, 160 + "minItems": 3, 161 + "maxItems": 3 162 + }, 163 + "equidistant4": { 164 + "type": "object", 165 + "required": [ 166 + "k1", 167 + "k2", 168 + "k3", 169 + "k4" 170 + ], 171 + "additionalProperties": false, 172 + "properties": { 173 + "k1": { 174 + "type": "number" 175 + }, 176 + "k2": { 177 + "type": "number" 178 + }, 179 + "k3": { 180 + "type": "number" 181 + }, 182 + "k4": { 183 + "type": "number" 184 + } 185 + } 186 + }, 187 + "radtan5": { 188 + "type": "object", 189 + "required": [ 190 + "k1", 191 + "k2", 192 + "p1", 193 + "p2", 194 + "k3" 195 + ], 196 + "additionalProperties": false, 197 + "properties": { 198 + "k1": { 199 + "type": "number" 200 + }, 201 + "k2": { 202 + "type": "number" 203 + }, 204 + "p1": { 205 + "type": "number" 206 + }, 207 + "p2": { 208 + "type": "number" 209 + }, 210 + "k3": { 211 + "type": "number" 212 + } 213 + } 214 + }, 215 + "datetime": { 216 + "$comment": "The format specification might not be asserted against, that's why we also provide a regex pattern", 217 + "type": "string", 218 + "format": "date-time", 219 + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" 220 + } 221 + } 222 + }
+2
doc/example_configs/calibration_v2.schema.json.license
···
··· 1 + Copyright 2021, Collabora, Ltd. 2 + SPDX-License-Identifier: CC0-1.0
+1 -1
doc/example_configs/config_v0.schema.json
··· 204 "w" 205 ] 206 }, 207 - "vec3": { 208 "type": "object", 209 "title": "Vector3", 210 "properties": {
··· 204 "w" 205 ] 206 }, 207 + "vector3": { 208 "type": "object", 209 "title": "Vector3", 210 "properties": {