| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
cparamSearch.h
Go to the documentation of this file.
1/*
2 * cparamSearch.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 * Copyright 2015 Daqri, LLC.
33 * Copyright 2013-2015 ARToolworks, Inc.
34 *
35 * Author(s): Philip Lamb
36 *
37 */
38
39#ifndef CPARAMSEARCH_H
40#define CPARAMSEARCH_H
41
42#include <ARX/ARVideo/video.h>
43
44#if USE_CPARAM_SEARCH
45#ifdef __cplusplus
46 extern "C" {
47#endif
48
49// cacheDir NULL to use current working directory for camera parameter database cache, otherwise path to folder in which to write.
50// cacheInitDir NULL to look in current working directory for camera parameter database initial cache, otherwise path to folder in which to look.
51// resetCache 1 to reset the cache to initial state, or 0 to use existing cache (if any).
52// calibrationServerDownloadURL Full URL (including method) of calibration server download interface, or NULL to use default.
53// calibrationServerAuthenticationToken Unencoded authentication token to be supplied to calibration server, or NULL to use default.
54// Returns 0 if succesful, <0 if error.
55 int cparamSearchInit(const char *cacheDir, const char *cacheInitDir, int resetCache, const char *calibrationServerDownloadURL, const char *calibrationServerAuthenticationToken);
56
57// Returns 0 if succesful, <0 if error.
58 int cparamSearchFinal(void);
59
60// >= 0 is normal state.
61// < 0 is error state.
62 typedef enum {
63 CPARAM_SEARCH_STATE_INITIAL = 0, // The request has been received, but no action has been taken yet.
64 CPARAM_SEARCH_STATE_IN_PROGRESS = 1, // The request has been received, and is being processed.
65 CPARAM_SEARCH_STATE_RESULT_NULL = 2, // Request completed, but no cparam was available.
66 CPARAM_SEARCH_STATE_OK = 3, // The request succeeded, a cparam was available and returned.
67 CPARAM_SEARCH_STATE_FAILED_ERROR = -1, // The request failed because of some other unspecified error, typically a failure in the fetch module itself.
68 CPARAM_SEARCH_STATE_FAILED_NO_NETWORK = -2, // A network connection was required but was not available. The user should be asked to enable the network.
69 CPARAM_SEARCH_STATE_FAILED_NETWORK_FAILED = -3, // A network connection was required and available, but network I/O failed (e.g. connection dropped).
70 CPARAM_SEARCH_STATE_FAILED_SERVICE_UNREACHABLE = -4, // A network connection was required, and available, but the server could not be reached.
71 CPARAM_SEARCH_STATE_FAILED_SERVICE_UNAVAILABLE = -5, // The server reported itself temporarily unavailable. The search may be retried at a later time. Searches may be throttled.
72 CPARAM_SEARCH_STATE_FAILED_SERVICE_FAILED = -6, // The search failed due to an internal error in the server. The search may be retried at a later time. Searches may be throttled.
73 CPARAM_SEARCH_STATE_FAILED_SERVICE_NOT_PERMITTED = -7, // The search failed because access from this client is not permitted.
74 CPARAM_SEARCH_STATE_FAILED_SERVICE_INVALID_REQUEST = -8 // The search failed because the server did not understand it. This should be considered a permanent failure.
75} CPARAM_SEARCH_STATE;
76
77// Type signature for a function which will be called while the fetch operation is progressing.
78// May be called zero or more times with state=CPARAM_SEARCH_STATE_IN_PROGRESS and progress=[0.0,1.0].
79// Any other state constitutes a final report and the end of the operation.
80// If state=CPARAM_SEARCH_STATE_OK, the camera parameters are returned in *cparam, which should
81// be considered valid only for the duration of the callback.
82 typedef void (*CPARAM_SEARCH_CALLBACK)(CPARAM_SEARCH_STATE state, float progress, const ARParam *cparam, void *userdata);
83
84// Tell cparamSearch about the state of the Internet connection.
85// -1 State of Internet connection unknown. cparamSearch will attempt to determine the state. This is the initial state.
86// 0 Internet connection is down.
87// 1 Internet connection is up.
88 int cparamSearchSetInternetState(int state);
89
90// Normally returns CPARAM_SEARCH_STATE_INITIAL, and progress will be passed via the callback.
91// If any other state is returned however, that is definitive, and the callback will never be called.
92// The callback may occur on an arbitrary thread; ensure any variables it modifies are thread-safe.
93CPARAM_SEARCH_STATE cparamSearch(const char *device_id, int camera_index, int width, int height, float focal_length, CPARAM_SEARCH_CALLBACK callback, void *userdata);
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif // USE_CPARAM_SEARCH
100
101#endif // !CPARAMSEARCH_H
ARParam
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99
video.h