The open source OpenXR runtime
at main 48 lines 991 B view raw
1// Copyright 2019-2023, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3/*! 4 * @file 5 * @brief Loads and dumps a calibration file. 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 */ 8 9#include "xrt/xrt_compiler.h" 10#include "xrt/xrt_config_have.h" 11 12#include "cli_common.h" 13 14#ifdef XRT_HAVE_OPENCV 15#include "tracking/t_tracking.h" 16#endif 17 18#include <string.h> 19#include <stdio.h> 20 21#define P(...) fprintf(stderr, __VA_ARGS__) 22 23int 24cli_cmd_calibration_dump(int argc, const char **argv) 25{ 26#ifdef XRT_HAVE_OPENCV 27 if (argc < 3) { 28 P("Must be given a file path\n"); 29 return 1; 30 } 31 32 const char *filename = argv[2]; 33 34 struct t_stereo_camera_calibration *data = NULL; 35 if (!t_stereo_camera_calibration_load(filename, &data)) { 36 P("Could not load '%s'!\n", filename); 37 return 1; 38 } 39 40 t_stereo_camera_calibration_dump(data); 41 t_stereo_camera_calibration_reference(&data, NULL); 42 43 return 0; 44#else 45 P("Not compiled with XRT_HAVE_OPENCV, so can't load calibration files!\n"); 46 return 1; 47#endif 48}