ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
ARX_c.h
Go to the documentation of this file.
1/*
2 * ARX_c.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 2010-2015 ARToolworks, Inc.
34 *
35 * Author(s): Philip Lamb, Julian Looser.
36 *
37 */
38
39#ifndef ARX_C_H
40#define ARX_C_H
41
42#include <ARX/Platform.h>
43#include <ARX/Error.h>
44#include <stdint.h>
45
51extern "C" {
52
58 ARX_EXTERN void arwRegisterLogCallback(PFN_LOGCALLBACK callback);
59
60 ARX_EXTERN void arwSetLogLevel(const int logLevel);
61
62 // ----------------------------------------------------------------------------------------------------
63#pragma mark artoolkitX lifecycle functions
64 // ----------------------------------------------------------------------------------------------------
71 ARX_EXTERN bool arwInitialiseAR();
72
80 ARX_EXTERN bool arwGetARToolKitVersion(char *buffer, int length);
81
103 ARX_EXTERN int arwGetError();
104
111 ARX_EXTERN bool arwChangeToResourcesDir(const char *resourcesDirectoryPath);
112
120 ARX_EXTERN bool arwStartRunning(const char *vconf, const char *cparaName);
121
130 ARX_EXTERN bool arwStartRunningB(const char *vconf, const char *cparaBuff, const int cparaBuffLen);
131
132 ARX_EXTERN bool arwStartRunningStereo(const char *vconfL, const char *cparaNameL, const char *vconfR, const char *cparaNameR, const char *transL2RName);
133
134 ARX_EXTERN bool arwStartRunningStereoB(const char *vconfL, const char *cparaBuffL, const int cparaBuffLenL, const char *vconfR, const char *cparaBuffR, int cparaBuffLenR, const char *transL2RBuff, const int transL2RBuffLen);
135
140 ARX_EXTERN bool arwIsRunning();
141
146 ARX_EXTERN bool arwIsInited();
147
153 ARX_EXTERN bool arwStopRunning();
154
163 ARX_EXTERN bool arwShutdownAR();
164
165 // ----------------------------------------------------------------------------------------------------
166#pragma mark Video stream management
167 // ----------------------------------------------------------------------------------------------------
168
176 ARX_EXTERN bool arwGetProjectionMatrix(const float nearPlane, const float farPlane, float p[16]);
177
186 ARX_EXTERN bool arwGetProjectionMatrixStereo(const float nearPlane, const float farPlane, float pL[16], float pR[16]);
187
198 ARX_EXTERN bool arwGetVideoParams(int *width, int *height, int *pixelSize, char *pixelFormatStringBuffer, int pixelFormatStringBufferLen);
199
215 ARX_EXTERN bool arwGetVideoParamsStereo(int *widthL, int *heightL, int *pixelSizeL, char *pixelFormatStringBufferL, int pixelFormatStringBufferLenL, int *widthR, int *heightR, int *pixelSizeR, char *pixelFormatStringBufferR, int pixelFormatStringBufferLenR);
216
221 ARX_EXTERN bool arwCapture();
222
228 ARX_EXTERN bool arwUpdateAR();
229
230 // ----------------------------------------------------------------------------------------------------
231#pragma mark Video stream retrieval and/or drawing.
232 // ----------------------------------------------------------------------------------------------------
233
242 ARX_EXTERN bool arwUpdateTexture32(uint32_t *buffer);
243
256 ARX_EXTERN bool arwUpdateTexture32Stereo(uint32_t *bufferL, uint32_t *bufferR);
257
279 ARX_EXTERN bool arwDrawVideoInit(const int videoSourceIndex);
280
284 enum {
288 };
289
293 enum {
297 };
298
302 enum {
307 };
308
354 ARX_EXTERN bool arwDrawVideoSettings(int videoSourceIndex, int width, int height, bool rotate90, bool flipH, bool flipV, int hAlign, int vAlign, int scalingMode, int32_t viewport[4]);
355
374 ARX_EXTERN bool arwDrawVideo(const int videoSourceIndex);
375
391 ARX_EXTERN bool arwDrawVideoFinal(const int videoSourceIndex);
392
393 // ----------------------------------------------------------------------------------------------------
394#pragma mark Tracking configuration
395 // ----------------------------------------------------------------------------------------------------
399 enum {
412 };
413
419 ARX_EXTERN void arwSetTrackerOptionBool(int option, bool value);
420
426 ARX_EXTERN void arwSetTrackerOptionInt(int option, int value);
427
433 ARX_EXTERN void arwSetTrackerOptionFloat(int option, float value);
434
440 ARX_EXTERN bool arwGetTrackerOptionBool(int option);
441
447 ARX_EXTERN int arwGetTrackerOptionInt(int option);
448
454 ARX_EXTERN float arwGetTrackerOptionFloat(int option);
455
456 // ----------------------------------------------------------------------------------------------------
457#pragma mark Trackable management
458 // ----------------------------------------------------------------------------------------------------
471 ARX_EXTERN int arwAddTrackable(const char *cfg);
472
473 typedef struct {
474 int uid;
476 float matrix[16];
477 float matrixR[16]; // For stereo.
479
486 ARX_EXTERN bool arwGetTrackables(int *count_p, ARWTrackableStatus **statuses_p);
487
493 ARX_EXTERN bool arwRemoveTrackable(int trackableUID);
494
499 ARX_EXTERN int arwRemoveAllTrackables();
500
511 ARX_EXTERN bool arwQueryTrackableVisibilityAndTransformation(int trackableUID, float matrix[16]);
512
524 ARX_EXTERN bool arwQueryTrackableVisibilityAndTransformationStereo(int trackableUID, float matrixL[16], float matrixR[16]);
525
533 ARX_EXTERN int arwGetTrackablePatternCount(int trackableUID);
534
546 ARX_EXTERN bool arwGetTrackablePatternConfig(int trackableUID, int patternID, float matrix[16], float *width, float *height, int *imageSizeX, int *imageSizeY);
547
561 ARX_EXTERN bool arwGetTrackablePatternImage(int trackableUID, int patternID, uint32_t *buffer);
562
566 enum {
578 };
579
586 ARX_EXTERN void arwSetTrackableOptionBool(int trackableUID, int option, bool value);
587
594 ARX_EXTERN void arwSetTrackableOptionInt(int trackableUID, int option, int value);
595
602 ARX_EXTERN void arwSetTrackableOptionFloat(int trackableUID, int option, float value);
603
610 ARX_EXTERN bool arwGetTrackableOptionBool(int trackableUID, int option);
611
618 ARX_EXTERN int arwGetTrackableOptionInt(int trackableUID, int option);
619
626 ARX_EXTERN float arwGetTrackableOptionFloat(int trackableUID, int option);
627
628 // ----------------------------------------------------------------------------------------------------
629#pragma mark Utility
630 // ----------------------------------------------------------------------------------------------------
654 ARX_EXTERN bool arwLoadOpticalParams(const char *optical_param_name, const char *optical_param_buff, const int optical_param_buffLen, const float projectionNearPlane, const float projectionFarPlane, float *fovy_p, float *aspect_p, float m[16], float p[16]);
655}
656
657#endif // !ARX_C_H
ARX_EXTERN bool arwGetVideoParams(int *width, int *height, int *pixelSize, char *pixelFormatStringBuffer, int pixelFormatStringBufferLen)
Returns the parameters of the video source frame.
Definition: ARX_c.cpp:225
ARX_EXTERN void arwSetTrackerOptionBool(int option, bool value)
Set boolean options associated with a tracker.
Definition: ARX_c.cpp:318
ARX_EXTERN int arwGetError()
Return error information Returns the value of the error flag.
Definition: ARX_c.cpp:108
ARX_EXTERN bool arwGetTrackables(int *count_p, ARWTrackableStatus **statuses_p)
Gets all current trackables and their status.
Definition: ARX_c.cpp:435
ARX_EXTERN bool arwGetTrackablePatternConfig(int trackableUID, int patternID, float matrix[16], float *width, float *height, int *imageSizeX, int *imageSizeY)
Gets configuration of a pattern associated with a trackable.
Definition: ARX_c.cpp:538
ARX_EXTERN bool arwUpdateTexture32Stereo(uint32_t *bufferL, uint32_t *bufferR)
Asks the video source to push the most recent stereo frame into the passed-in buffer.
Definition: ARX_c.cpp:277
ARX_EXTERN bool arwShutdownAR()
Shuts down the artoolkitX and frees all resources.
Definition: ARX_c.cpp:175
ARX_EXTERN void arwSetTrackableOptionInt(int trackableUID, int option, int value)
Set integer options associated with a trackable.
Definition: ARX_c.cpp:661
ARX_EXTERN bool arwGetTrackerOptionBool(int option)
Get boolean options associated with a tracker.
Definition: ARX_c.cpp:374
ARX_EXTERN bool arwIsInited()
Returns true if artoolkitX is initialized and read for adding trackables.
Definition: ARX_c.cpp:163
ARX_EXTERN void arwSetTrackableOptionFloat(int trackableUID, int option, float value)
Set floating-point options associated with a trackable.
Definition: ARX_c.cpp:733
ARX_EXTERN bool arwInitialiseAR()
Initialises the artoolkitX.
Definition: ARX_c.cpp:90
ARX_EXTERN bool arwStartRunning(const char *vconf, const char *cparaName)
Initialises and starts video capture.
Definition: ARX_c.cpp:133
ARX_EXTERN bool arwDrawVideo(const int videoSourceIndex)
Draws the latest frame from the video source in the active graphics context.
Definition: ARX_c.cpp:300
ARX_EXTERN bool arwStartRunningStereoB(const char *vconfL, const char *cparaBuffL, const int cparaBuffLenL, const char *vconfR, const char *cparaBuffR, int cparaBuffLenR, const char *transL2RBuff, const int transL2RBuffLen)
Definition: ARX_c.cpp:151
ARX_EXTERN float arwGetTrackableOptionFloat(int trackableUID, int option)
Get floating-point options associated with a trackable.
Definition: ARX_c.cpp:681
@ ARW_TRACKABLE_OPTION_SQUARE_USE_CONT_POSE_ESTIMATION
bool, true to use continuous pose estimate.
Definition: ARX_c.h:570
@ ARW_TRACKABLE_OPTION_MULTI_MIN_CONF_MATRIX
float, minimum confidence value for submarker matrix tracking to be valid.
Definition: ARX_c.h:575
@ ARW_TRACKABLE_OPTION_SQUARE_CONFIDENCE_CUTOFF
float, minimum allowable confidence value used in marker matching.
Definition: ARX_c.h:572
@ ARW_TRACKABLE_OPTION_FILTER_CUTOFF_FREQ
float, cutoff frequency of filter.
Definition: ARX_c.h:569
@ ARW_TRACKABLE_OPTION_NFT_SCALE
float, scale factor applied to NFT marker size.
Definition: ARX_c.h:573
@ ARW_TRACKABLE_OPTION_FILTERED
bool, true for filtering enabled.
Definition: ARX_c.h:567
@ ARW_TRACKABLE_OPTION_SQUARE_CONFIDENCE
float, confidence value of most recent marker match
Definition: ARX_c.h:571
@ ARW_TRACKABLE_OPTION_MULTI_MIN_SUBMARKERS
int, minimum number of submarkers for tracking to be valid.
Definition: ARX_c.h:574
@ ARW_TRACKABLE_OPTION_FILTER_SAMPLE_RATE
float, sample rate for filter calculations.
Definition: ARX_c.h:568
@ ARW_TRACKABLE_OPTION_MULTI_MIN_INLIER_PROB
float, minimum inlier probability value for robust multimarker pose estimation (range 1....
Definition: ARX_c.h:577
@ ARW_TRACKABLE_OPTION_MULTI_MIN_CONF_PATTERN
float, minimum confidence value for submarker pattern tracking to be valid.
Definition: ARX_c.h:576
ARX_EXTERN bool arwGetVideoParamsStereo(int *widthL, int *heightL, int *pixelSizeL, char *pixelFormatStringBufferL, int pixelFormatStringBufferLenL, int *widthR, int *heightR, int *pixelSizeR, char *pixelFormatStringBufferR, int pixelFormatStringBufferLenR)
Returns the parameters of the video source frames.
Definition: ARX_c.cpp:239
ARX_EXTERN bool arwStartRunningStereo(const char *vconfL, const char *cparaNameL, const char *vconfR, const char *cparaNameR, const char *transL2RName)
Definition: ARX_c.cpp:145
ARX_EXTERN bool arwStopRunning()
Stops video capture and frees video capture resources.
Definition: ARX_c.cpp:169
ARX_EXTERN void arwSetTrackerOptionInt(int option, int value)
Set integer options associated with a tracker.
Definition: ARX_c.cpp:333
ARX_EXTERN bool arwDrawVideoSettings(int videoSourceIndex, int width, int height, bool rotate90, bool flipH, bool flipV, int hAlign, int vAlign, int scalingMode, int32_t viewport[4])
Specify the layout of the graphics context in which drawing of video frames will occur.
Definition: ARX_c.cpp:293
ARX_EXTERN bool arwGetTrackableOptionBool(int trackableUID, int option)
Get boolean options associated with a trackable.
Definition: ARX_c.cpp:593
ARX_EXTERN void arwSetTrackerOptionFloat(int option, float value)
Set floating-point options associated with a tracker.
Definition: ARX_c.cpp:364
ARX_EXTERN int arwGetTrackerOptionInt(int option)
Get integer options associated with a tracker.
Definition: ARX_c.cpp:390
ARX_EXTERN bool arwGetProjectionMatrix(const float nearPlane, const float farPlane, float p[16])
Populates the given float array with the projection matrix computed from camera parameters for the vi...
Definition: ARX_c.cpp:190
ARX_EXTERN int arwAddTrackable(const char *cfg)
Adds a trackable as specified in the given configuration string.
Definition: ARX_c.cpp:429
ARX_EXTERN bool arwUpdateAR()
Performs tracking and trackable updates.
Definition: ARX_c.cpp:265
ARX_EXTERN float arwGetTrackerOptionFloat(int option)
Get floating-point options associated with a tracker.
Definition: ARX_c.cpp:414
ARX_EXTERN bool arwGetARToolKitVersion(char *buffer, int length)
Gets the artoolkitX version as a string, such as "10.0.0".
Definition: ARX_c.cpp:96
ARX_EXTERN bool arwLoadOpticalParams(const char *optical_param_name, const char *optical_param_buff, const int optical_param_buffLen, const float projectionNearPlane, const float projectionFarPlane, float *fovy_p, float *aspect_p, float m[16], float p[16])
Loads an optical parameters structure from file or from buffer.
Definition: ARX_c.cpp:776
ARX_EXTERN void arwSetTrackableOptionBool(int trackableUID, int option, bool value)
Set boolean options associated with a trackable.
Definition: ARX_c.cpp:617
ARX_EXTERN bool arwGetProjectionMatrixStereo(const float nearPlane, const float farPlane, float pL[16], float pR[16])
Populates the given float arrays with the projection matrices computed from camera parameters for eac...
Definition: ARX_c.cpp:206
ARX_EXTERN bool arwDrawVideoInit(const int videoSourceIndex)
Initialise drawing of video frames in a graphics context.
Definition: ARX_c.cpp:286
@ ARW_V_ALIGN_CENTRE
Align the centre of the video frame with the centre of the context.
Definition: ARX_c.h:295
@ ARW_V_ALIGN_TOP
Align the top edge of the video frame with the top edge of the context.
Definition: ARX_c.h:294
@ ARW_V_ALIGN_BOTTOM
Align the bottom edge of the video frame with the bottom edge of the context.
Definition: ARX_c.h:296
ARX_EXTERN bool arwChangeToResourcesDir(const char *resourcesDirectoryPath)
Changes the working directory to the resources directory used by artoolkitX.
Definition: ARX_c.cpp:114
ARX_EXTERN bool arwDrawVideoFinal(const int videoSourceIndex)
Finalise drawing of video frames in a graphics context.
Definition: ARX_c.cpp:307
ARX_EXTERN int arwRemoveAllTrackables()
Clears the collection of trackables.
Definition: ARX_c.cpp:475
ARX_EXTERN bool arwUpdateTexture32(uint32_t *buffer)
Asks the video source to push the most recent frame into the passed-in buffer.
Definition: ARX_c.cpp:271
@ ARW_SCALE_MODE_1_TO_1
Do not scale the video frame. One pixel of the video frame will be represented by one pixel of the gr...
Definition: ARX_c.h:306
@ ARW_SCALE_MODE_FIT
Scale the video frame proportionally up or down so that it fits visible in its entirety in the graphi...
Definition: ARX_c.h:303
@ ARW_SCALE_MODE_FILL
Scale the video frame proportionally up or down so that it fills the entire in the graphics context....
Definition: ARX_c.h:304
@ ARW_SCALE_MODE_STRETCH
Scale the video frame non-proportionally up or down so that it matches exactly the size of the graphi...
Definition: ARX_c.h:305
ARX_EXTERN int arwGetTrackablePatternCount(int trackableUID)
Returns the number of pattern images associated with the specified trackable.
Definition: ARX_c.cpp:526
ARX_EXTERN bool arwStartRunningB(const char *vconf, const char *cparaBuff, const int cparaBuffLen)
Initialises and starts video capture.
Definition: ARX_c.cpp:139
ARX_EXTERN bool arwQueryTrackableVisibilityAndTransformation(int trackableUID, float matrix[16])
Returns the visibility and pose of the specified trackable.
Definition: ARX_c.cpp:495
@ ARW_TRACKER_OPTION_SQUARE_BORDER_SIZE
float in range (0-0.5).
Definition: ARX_c.h:405
@ ARW_TRACKER_OPTION_SQUARE_MATRIX_CODE_TYPE
int.
Definition: ARX_c.h:406
@ ARW_TRACKER_OPTION_NFT_MULTIMODE
int.
Definition: ARX_c.h:400
@ ARW_TRACKER_OPTION_SQUARE_THRESHOLD
Threshold value used for image binarization. int in range [0-255].
Definition: ARX_c.h:401
@ ARW_TRACKER_OPTION_SQUARE_PATTERN_COUNT_MAX
Maximum number of square template (pattern) markers that may be loaded at once. Defaults to AR_PATT_N...
Definition: ARX_c.h:410
@ ARW_TRACKER_OPTION_SQUARE_THRESHOLD_MODE
Threshold mode used for image binarization. int.
Definition: ARX_c.h:402
@ ARW_TRACKER_OPTION_SQUARE_IMAGE_PROC_MODE
int.
Definition: ARX_c.h:407
@ ARW_TRACKER_OPTION_2D_TRACKER_FEATURE_TYPE
Feature detector type used in the 2d Tracker - 0 AKAZE, 1 ORB, 2 BRISK, 3 KAZE.
Definition: ARX_c.h:411
@ ARW_TRACKER_OPTION_SQUARE_DEBUG_MODE
Enables or disable state of debug mode in the tracker. When enabled, a black and white debug image is...
Definition: ARX_c.h:408
@ ARW_TRACKER_OPTION_SQUARE_PATTERN_SIZE
Number of rows and columns in square template (pattern) markers. Defaults to AR_PATT_SIZE1,...
Definition: ARX_c.h:409
@ ARW_TRACKER_OPTION_SQUARE_PATTERN_DETECTION_MODE
int.
Definition: ARX_c.h:404
@ ARW_TRACKER_OPTION_SQUARE_LABELING_MODE
int.
Definition: ARX_c.h:403
ARX_EXTERN void arwRegisterLogCallback(PFN_LOGCALLBACK callback)
Registers a callback function to use when a message is logged.
Definition: ARX_c.cpp:74
@ ARW_H_ALIGN_CENTRE
Align the centre of the video frame with the centre of the context.
Definition: ARX_c.h:286
@ ARW_H_ALIGN_LEFT
Align the left edge of the video frame with the left edge of the context.
Definition: ARX_c.h:285
@ ARW_H_ALIGN_RIGHT
Align the right edge of the video frame with the right edge of the context.
Definition: ARX_c.h:287
ARX_EXTERN bool arwCapture()
Captures a newest frame from the video source.
Definition: ARX_c.cpp:259
ARX_EXTERN bool arwIsRunning()
Returns true if artoolkitX is running, i.e.
Definition: ARX_c.cpp:157
ARX_EXTERN bool arwGetTrackablePatternImage(int trackableUID, int patternID, uint32_t *buffer)
Gets a pattern image associated with a trackable.
Definition: ARX_c.cpp:564
ARX_EXTERN void arwSetLogLevel(const int logLevel)
Definition: ARX_c.cpp:79
ARX_EXTERN bool arwQueryTrackableVisibilityAndTransformationStereo(int trackableUID, float matrixL[16], float matrixR[16])
Returns the visibility and stereo pose of the specified trackable.
Definition: ARX_c.cpp:508
ARX_EXTERN bool arwRemoveTrackable(int trackableUID)
Removes the trackable with the given unique identifier (UID).
Definition: ARX_c.cpp:469
ARX_EXTERN int arwGetTrackableOptionInt(int trackableUID, int option)
Get integer options associated with a trackable.
Definition: ARX_c.cpp:640
Defines error codes used in the ARX library.
void(CALL_CONV * PFN_LOGCALLBACK)(const char *msg)
Definition: Platform.h:101
Definition: ARX_c.h:473
bool visible
Definition: ARX_c.h:475
int uid
Definition: ARX_c.h:474