ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
param.h
Go to the documentation of this file.
1/*
2 * param.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 2003-2015 ARToolworks, Inc.
34 *
35 * Author(s): Takeshi Mita, Shinsaku Hiura, Hirokazu Kato, Philip Lamb
36 *
37 */
38/*******************************************************
39 *
40 * Author: Takeshi Mita, Shinsaku Hiura, Hirokazu Kato
41 *
42 * tmita@inolab.sys.es.osaka-u.ac.jp
43 * shinsaku@sys.es.osaka-u.ac.jp
44 * kato@sys.im.hiroshima-cu.ac.jp
45 *
46 * Revision: 5.0
47 * Date: 03/08/13
48 *
49 *******************************************************/
50
51#ifndef AR_PARAM_H
52#define AR_PARAM_H
53
54#include <ARX/AR/ar.h>
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
69#define AR_DIST_FUNCTION_VERSION_DEFAULT 5
74#define AR_DIST_FUNCTION_VERSION_MAX 5
79#define AR_DIST_FACTOR_NUM_MAX 17
84#define AR_PARAM_LT_DEFAULT_OFFSET 15
85
99typedef struct {
100 int xsize;
101 int ysize;
102 ARdouble mat[3][4];
105} ARParam;
106
107typedef struct {
115
120typedef struct {
121 float *i2o;
122 float *o2i;
123 int xsize;
124 int ysize;
125 int xOff;
126 int yOff;
127} ARParamLTf;
128
129//typedef struct {
130// short *i2o;
131// short *o2i;
132// int xsize;
133// int ysize;
134// int xOff;
135// int yOff;
136//} ARParamLTi;
137
151typedef struct {
154 //ARParamLTi paramLTi;
155} ARParamLT;
156
157AR_EXTERN int arParamDisp( const ARParam *param );
158
175AR_EXTERN int arParamClear( ARParam *param, int xsize, int ysize, int dist_function_version );
176
177AR_EXTERN int arParamDistFactorClear( ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], int xsize, int ysize, int dist_function_version );
178
194AR_EXTERN int arParamClearWithFOVy(ARParam *param, int xsize, int ysize, ARdouble FOVy);
195
196AR_EXTERN int arParamChangeSizeWithZoom(ARParam *source, int xsize, int ysize, ARdouble x_zoom, ARdouble y_zoom, ARParam *newparam);
197
212AR_EXTERN int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam );
213
214AR_EXTERN int arParamDecomp( const ARParam *source, ARParam *icpara, ARdouble trans[3][4] );
215
216AR_EXTERN int arParamDecompMat( const ARdouble source[3][4], ARdouble cpara[3][4], ARdouble trans[3][4] );
217
218#ifdef ARDOUBLE_IS_FLOAT
219#define arParamDecompMatf arParamDecompMat
220#else
221AR_EXTERN int arParamDecompMatf( const ARdouble source[3][4], float cpara[3][4], float trans[3][4] );
222#endif
223
250AR_EXTERN int arParamIdeal2Observ( const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ix, const ARdouble iy,
251 ARdouble *ox, ARdouble *oy, const int dist_function_version );
252
299AR_EXTERN int arParamObserv2Ideal( const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ox, const ARdouble oy,
300 ARdouble *ix, ARdouble *iy, const int dist_function_version );
314AR_EXTERN int arParamSave( const char *filename, const int num, const ARParam *param, ...);
315
329AR_EXTERN int arParamLoad( const char *filename, int num, ARParam *param, ...);
330
344AR_EXTERN int arParamLoadFromBuffer( const void *buffer, size_t bufsize, ARParam *param);
345
346AR_EXTERN int arParamGetPerspectiveMat( ARdouble global[][3], ARdouble idealScreen[][2], int data_num, ARdouble mat[3][4] );
347
361AR_EXTERN int arParamSaveExt( const char *filename, ARdouble para[3][4] );
362
376AR_EXTERN int arParamLoadExt( const char *filename, ARdouble para[3][4] );
377
393AR_EXTERN int arParamLoadExtFromBuffer(const void *buffer, size_t bufsize, ARdouble para[3][4] );
394
402AR_EXTERN int arParamDispExt( ARdouble para[3][4]);
403
404AR_EXTERN int arParamSaveOptical(const char *filename, const ARdouble fovy, const ARdouble aspect, const ARdouble m[16]);
405AR_EXTERN int arParamLoadOptical(const char *filename, ARdouble *fovy_p, ARdouble *aspect_p, ARdouble m[16]);
406AR_EXTERN int arParamLoadOpticalFromBuffer(const void *buffer, size_t bufsize, ARdouble *fovy_p, ARdouble *aspect_p, ARdouble m[16]);
407AR_EXTERN int arParamDispOptical(const ARdouble fovy, const ARdouble aspect, const ARdouble m[16]);
408
409AR_EXTERN int arParamLTSave( char *filename, char *ext, ARParamLT *paramLT );
410AR_EXTERN ARParamLT *arParamLTLoad( char *filename, char *ext );
411
432AR_EXTERN ARParamLT *arParamLTCreate( ARParam *param, int offset );
433
441AR_EXTERN int arParamLTFree( ARParamLT **paramLT_p );
442
466AR_EXTERN int arParamIdeal2ObservLTf( const ARParamLTf *paramLTf, const float ix, const float iy, float *ox, float *oy);
467
468
505AR_EXTERN int arParamObserv2IdealLTf( const ARParamLTf *paramLTf, const float ox, const float oy, float *ix, float *iy);
506
507//int arParamIdeal2ObservLTi( const ARParamLTi *paramLTi, const int ix, const int iy, int *ox, int *oy);
508
509//int arParamObserv2IdealLTi( const ARParamLTi *paramLTi, const int ox, const int oy, int *ix, int *iy);
510
511#ifdef __cplusplus
512}
513#endif
514#endif
artoolkitX core routines.
double ARdouble
Definition: ar.h:99
#define AR_EXTERN
Definition: ar.h:131
#define AR_DIST_FACTOR_NUM_MAX
Maximum number of values in a distortion factor array.
Definition: param.h:79
AR_EXTERN int arParamLTSave(char *filename, char *ext, ARParamLT *paramLT)
Definition: paramLT.c:46
AR_EXTERN int arParamLoadOptical(const char *filename, ARdouble *fovy_p, ARdouble *aspect_p, ARdouble m[16])
Definition: paramFile.c:595
AR_EXTERN int arParamLoadExtFromBuffer(const void *buffer, size_t bufsize, ARdouble para[3][4])
Load camera extrinsic parameters into a matrix from a binary buffer.
Definition: paramFile.c:510
const arParamVersionInfo_t arParamVersionInfo[AR_DIST_FUNCTION_VERSION_MAX]
Constant array with parameters applicable to each version of the camera parameter distortion function...
Definition: paramFile.c:64
AR_EXTERN int arParamDecompMat(const ARdouble source[3][4], ARdouble cpara[3][4], ARdouble trans[3][4])
Definition: paramDecomp.c:77
AR_EXTERN int arParamDecomp(const ARParam *source, ARParam *icpara, ARdouble trans[3][4])
Definition: paramDecomp.c:64
AR_EXTERN int arParamDispOptical(const ARdouble fovy, const ARdouble aspect, const ARdouble m[16])
Definition: paramDisp.c:111
AR_EXTERN int arParamDisp(const ARParam *param)
Definition: paramDisp.c:56
AR_EXTERN int arParamGetPerspectiveMat(ARdouble global[][3], ARdouble idealScreen[][2], int data_num, ARdouble mat[3][4])
Definition: paramGetPerspective.c:60
#define AR_DIST_FUNCTION_VERSION_MAX
Maximum version allowable for functions accepting a "distortion function version" parameter.
Definition: param.h:74
AR_EXTERN int arParamDispExt(ARdouble para[3][4])
Print camera extrinsic matrix to stdout.
Definition: paramDisp.c:97
AR_EXTERN int arParamLoadOpticalFromBuffer(const void *buffer, size_t bufsize, ARdouble *fovy_p, ARdouble *aspect_p, ARdouble m[16])
Definition: paramFile.c:650
AR_EXTERN int arParamObserv2IdealLTf(const ARParamLTf *paramLTf, const float ox, const float oy, float *ix, float *iy)
Use a lookup-table camera parameter to convert observed (distorted) window coordinates to idealised (...
Definition: paramLT.c:286
AR_EXTERN int arParamSaveOptical(const char *filename, const ARdouble fovy, const ARdouble aspect, const ARdouble m[16])
Definition: paramFile.c:540
AR_EXTERN int arParamChangeSize(ARParam *source, int xsize, int ysize, ARParam *newparam)
Adjust the size of a camera parameter's viewing plane, e.g. to match a renderer frustum size.
Definition: paramChangeSize.c:55
AR_EXTERN ARParamLT * arParamLTCreate(ARParam *param, int offset)
Allocate and calculate a lookup-table camera parameter from a standard camera parameter.
Definition: paramLT.c:169
AR_EXTERN int arParamIdeal2Observ(const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ix, const ARdouble iy, ARdouble *ox, ARdouble *oy, const int dist_function_version)
Use lens distortion parameters to convert idealised (zero-distortion) window coordinates to observed ...
Definition: paramDistortion.c:259
AR_EXTERN int arParamLoad(const char *filename, int num, ARParam *param,...)
Load camera intrinsics (pinhole lens model and distortion parameters) from a file.
Definition: paramFile.c:263
AR_EXTERN int arParamObserv2Ideal(const ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], const ARdouble ox, const ARdouble oy, ARdouble *ix, ARdouble *iy, const int dist_function_version)
Use lens distortion parameters to convert observed (distorted) window coordinates to idealised (zero-...
Definition: paramDistortion.c:62
AR_EXTERN int arParamSave(const char *filename, const int num, const ARParam *param,...)
Save camera intrinsics (pinhole lens model and distortion parameters) to a file.
Definition: paramFile.c:197
AR_EXTERN int arParamChangeSizeWithZoom(ARParam *source, int xsize, int ysize, ARdouble x_zoom, ARdouble y_zoom, ARParam *newparam)
Definition: paramChangeSize.c:60
AR_EXTERN int arParamLoadExt(const char *filename, ARdouble para[3][4])
Load camera extrinsic parameters into a matrix from a binary file.
Definition: paramFile.c:464
AR_EXTERN int arParamSaveExt(const char *filename, ARdouble para[3][4])
Save camera extrinsic parameters from a matrix to a binary file.
Definition: paramFile.c:417
AR_EXTERN int arParamLoadFromBuffer(const void *buffer, size_t bufsize, ARParam *param)
Load camera intrinsics (pinhole lens model and distortion parameters) from a buffer.
Definition: paramFile.c:370
AR_EXTERN int arParamIdeal2ObservLTf(const ARParamLTf *paramLTf, const float ix, const float iy, float *ox, float *oy)
Use a lookup-table camera parameter to convert idealised (zero-distortion) window coordinates to obse...
Definition: paramLT.c:252
AR_EXTERN int arParamClear(ARParam *param, int xsize, int ysize, int dist_function_version)
Create a camera parameter structure representing an idealised lens.
Definition: paramClear.c:53
AR_EXTERN ARParamLT * arParamLTLoad(char *filename, char *ext)
Definition: paramLT.c:92
AR_EXTERN int arParamLTFree(ARParamLT **paramLT_p)
Dispose of a memory allocated to a lookup-table camera parameter.
Definition: paramLT.c:221
AR_EXTERN int arParamDistFactorClear(ARdouble dist_factor[AR_DIST_FACTOR_NUM_MAX], int xsize, int ysize, int dist_function_version)
Definition: paramClear.c:77
AR_EXTERN int arParamClearWithFOVy(ARParam *param, int xsize, int ysize, ARdouble FOVy)
Create a camera parameter structure representing an idealised lens with specified field-of-view.
Definition: paramClear.c:137
AR_EXTERN int arParamDecompMatf(const ARdouble source[3][4], float cpara[3][4], float trans[3][4])
Definition: paramDecomp.c:145
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99
int ysize
The height in pixels of images returned by arVideoGetImage() for the camera.
Definition: param.h:101
int dist_function_version
See function arParamObserv2Ideal() for discussion. Must be last field in structure (as will not be wr...
Definition: param.h:104
int xsize
The width in pixels of images returned by arVideoGetImage() for the camera.
Definition: param.h:100
Structure holding camera parameters, in lookup table form.
Definition: param.h:151
ARParam param
A copy of original ARParam from which the lookup table was calculated.
Definition: param.h:152
ARParamLTf paramLTf
The lookup table.
Definition: param.h:153
Structure holding camera parameters, in lookup table form; floating point version.
Definition: param.h:120
int xsize
The number of pixels in the array's x dimension, including the offset areas on the left and right sid...
Definition: param.h:123
float * i2o
Ideal-to-observed; for the location in the array corresponding to the idealised location,...
Definition: param.h:121
int ysize
The number of pixels in the array's x dimension, including the offset areas on the top and bottom....
Definition: param.h:124
int yOff
The number of pixels from the top edge of the array to row zero of the input.
Definition: param.h:126
float * o2i
Observed-to-ideal; for the location in the array corresponding to the observed location,...
Definition: param.h:122
int xOff
The number of pixels from the left edge of the array to column zero of the input.
Definition: param.h:125
Definition: param.h:107
int dist_factor_num
Definition: param.h:108
int ARParam_size
Definition: param.h:109