documentation

vlSDK_Apple.h
Go to the documentation of this file.
1 //
2 // vlSDK_Apple.h
3 // VisionLib Objective-C Interface
4 //
5 // Created by Timo Engelke on 02.11.16.
6 // Copyright © 2016-2018 Visometry GmbH. All rights reserved.
7 //
8 // Version 0.4
9 //
10 
34 #ifndef vlSDK_APPLE_h
35 #define vlSDK_APPLE_h
36 
37 #include "vlSDKDef.h"
38 
39 #import <Foundation/Foundation.h>
40 #if defined(__arm__) || defined(__arm64__)
41 #define vlSDKFOR_IPHONE
42 #endif
43 
44 #ifdef vlSDKFOR_IPHONE
45 #import <UIKit/UIKit.h>
46 #endif
47 
48 #import <Metal/Metal.h>
49 #import <CoreImage/CoreImage.h>
50 
51 /*
52 @interface vlCameraDevice:NSObject {
53 @public
54  NSString *deviceID;
55  NSString *internalID;
56  NSString *cameraName;
57  NSString *position;
58  NSString *prefRes;
59 }
60 @end
61 
62 @interface vlDeviceInfo:NSObject {
63 @public
64  NSString *os;
65  NSString *manufacture;
66  NSString *model;
67  NSString *modelVersion;
68  NSString *unifiedID;
69  NSString *internalModelID;
70  NSString *appID;
71  int numberOfProcessors;
72  int nativeResX;
73  int nativeResY;
74  int currentDisplayOrientation;
75  bool usingEventLogger;
76  bool cameraAllowed;
77  NSArray<vlCameraDevice *> *availableCameras;
78 }
79  @end
80 */
81 
82 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingObjectState:NSObject {
83 @public
84  NSString* name;
85  NSString* state;
86  float quality;
87  float _InitInlierRatio;
88  int _InitNumOfCorresp;
89  float _TrackingInlierRatio;
90  int _TrackingNumOfCorresp;
91  float _SFHFrameDist;
92  int _NumberOfPatternRecognitions;
93  int _NumberOfTemplates;
94  int _NumberOfTemplatesDynamic;
95  int _NumberOfTemplatesStatic;
96  int _NumberOfLineModels;
97  float _AutoInitSetupProgress;
98  int _TrackingImageWidth;
99  int _TrackingImageHeight;
100  double timeStamp;
101 }
102 @end
103 
104 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingDeviceState:NSObject {
105 @public
106  NSString* name;
107  NSString* _WorldMappingStatus;
108 }
109 @end
110 
111 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingState:NSObject {
112 @public
113  NSArray<vlTrackingObjectState*>* objects;
114  NSArray<vlTrackingDeviceState*>* inputs;
115 }
116 @end
117 
125 FOUNDATION_EXPORT VL_SDK_API @interface vlModelProperties:NSObject {
126 @public
127 
129  bool enabled;
130 
132  NSString *modelHash;
133 
135  NSString *name;
136 
138  NSString *uri;
139 
141  bool occluder;
142 
145 
148 }
149 /*@property (atomic, assign) bool enabled;
150 @property (nonatomic, retain) NSString * _Nonnull modelHash;
151 @property (nonatomic, retain) NSString *_Nonnull name;
152 @property (nonatomic, assign) bool occluder;
153 @property (nonatomic, assign) int subMeshCount;
154 @property (nonatomic, assign) int triangleCount;
155 @property (nonatomic, retain) NSString *_Nonnull uri;
156 */
157 - (NSString * _Nullable)toString;
158 @end
159 
160 FOUNDATION_EXPORT VL_SDK_API @interface VLIssue:NSObject {
161 @public
162  NSString *info;
163  int code;
164  NSString *message;
165 }
166 @end
167 
168 FOUNDATION_EXPORT VL_SDK_API @interface VLIssues:NSObject {
169 @public
170  NSArray<VLIssue *> *issues;
171 }
173 -(BOOL)hasCode:(int)code;
174 
175 @end
176 
184 FOUNDATION_EXPORT VL_SDK_API @protocol vlFrameListenerInterface <NSObject>
185 
186 @optional
187 
188 //
189 
196 -(NSMutableData * _Nonnull )onGetDebugImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
197 
206 -(void)onRawDebugImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
207 
214 -(void)onMetalDebugImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
215 
222 -(void)onCGDebugImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
223 
224 
225 
233 -(NSMutableData * _Nonnull )onGetImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
234 
243 -(void)onRawImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
244 
251 -(void)onMetalImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
252 
259 -(void)onCGImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
260 
261 
263 
268 -(void)onTrackerInitialized:(bool)worked;
269 
278 -(void)onIssuesTriggered:(VLIssues* _Nullable)warnings andErrors:(VLIssues* _Nullable)errors;
279 
285 -(void)onExtrinsicData:(float * _Nonnull)data isValid:(bool)valid;
286 
291 -(void)onIntrinsicData:(float * _Nonnull)data;
292 
302 -(void)onIntrinsicDataWithWidth:(float)width height:(float)height cx:(float)cx cy:(float)cy fx:(float)fx fy:(float)fy;
303 
310 -(void)onLog:(NSString * _Nonnull)logString;
311 
316 -(void)onTrackingPaused:(BOOL)worked;
317 
321 -(void)onSteppedFrame;
322 
344 -(void)onTrackingInformation:(vlTrackingState* _Nonnull)state;
345 
349 -(void)onInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
350 
354 -(void)onInitPoseMatrix:(float * _Nonnull)m;
355 
360 -(void)onResetTracking:(BOOL)hard;
361 
362 
364 
369 -(void) onCalibrationResults:(NSString * _Nullable)json;
370 
371 
377 -(void) onGetAttribute:(NSString *_Nonnull)name withValue:(NSString *_Nonnull)value;
378 
379 
380 -(void)onModelProperties:(NSArray<vlModelProperties*>* _Nonnull)info;
381 -(void)onModelRemoved:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
382 -(void)onRawModelAdded:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
383 @end
384 
385 
390 FOUNDATION_EXPORT VL_SDK_API @interface vlSDK : NSObject {
391 }
392 
399 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(id _Nullable)delegate __attribute((deprecated("Use functions that also set licensePath or licenseData")));
400 
408 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(id _Nullable)delegate;
409 
417 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(id _Nullable)delegate;
418 
428 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options __attribute((deprecated("Use functions that also set licensePath or licenseData")));
429 
440 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
441 
452 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
453 
454 
458 - (void) dealloc;
459 
463 - (void) shutDown;
464 
471 -(void) process;
472 
477 -(void)step;
478 
483 -(BOOL) isPaused;
484 
485 
490 -(void) pause:(BOOL)enable;
491 
495 -(void) run;
496 
500 -(void) stop;
501 -(void) start;
502 
503 #ifdef vlSDKFOR_IPHONE
504 
505 
509 -(void) setDeviceOrientation:(UIDeviceOrientation)orientation withWidth:(int)width andHeight:(int)height;
510 #else
511 
515 -(void) windowResized:(CGSize)size;
516 
517 #endif
518 
523 -(void) setLogLevel:(int)level;
524 
529 -(void) setFPS:(unsigned int)fps;
530 
537 -(void) setNearPlane:(float)near andFarPlane:(float)far;
538 
544 -(void) setInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
545 
550 -(void) setInitPoseFromMatrix:(float * _Nonnull)m;
551 
553 
558 -(void) configureExtrinsicCameraInverted:(BOOL)invert;
559 
563 -(void) resetSoft;
564 
570 -(void) resetHard;
571 
575 -(void) getInitPose;
576 
582 -(BOOL) getLastExtrinsic:(float * _Nonnull)m;
583 
589 -(void) applyInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float)angle;
590 
597 -(void) getInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float* _Nonnull)angle;
598 
605 -(BOOL) enableDebugImage;
606 
610 -(BOOL) disableDebugImage;
611 
612 #ifdef vlSDKFOR_IPHONE
616 -(void)startAlignInitPoseWithSensor;
617 
621 -(void)stopAlignInitPoseWithSensor;
622 #endif
623 
624 #ifdef vlSDKFOR_IPHONE
625 
629 -(UIImage * _Nullable)getLastImage;
630 #else
631 
635 -(NSImage * _Nullable) getLastImage;
636 
637 #endif
638 
645 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withFloatValue:(float)value;
646 
653 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withStringValue:(NSString * _Nonnull)value;
654 
660 -(void)getAttributeRequest:(NSString * _Nonnull)attribute;
661 
662 
668 -(void)setCalibrationCommand:(NSString * _Nonnull)command;
669 
675 -(void)writeCalibrationDB:(NSString * _Nonnull)uri;
676 
683 -(NSString * _Nullable)getTrackerType;
684 
691 -(NSString * _Nullable)getDeviceType;
692 
704 -(void)writeInitData:(NSString *_Nonnull)uri;
705 
706 
707 
708 
716 -(void)readInitData:(NSString *_Nonnull)uri;
717 
721 -(void)resetInitData;
722 
723 
727 -(void)setModel:(NSString *_Nonnull)name property:(NSString *_Nonnull)property state:(bool)enable;
728 
729 
730 
734 -(void)requestModelProperties;
735 
739 -(void)requestModelData:(NSString*_Nonnull)name withOptions:(NSString *_Nonnull)options;
740 
741 
745 -(void)removeModel:(NSString*_Nonnull)nameURI;
746 
783 -(BOOL)addRawModelWithStruct:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
784 
785 
786 -(void)pushJsonAndBinaryCommand:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
787 -(void)pushJsonCommand:(NSString *_Nonnull)json;
788 -(void)writeLineModelData:(NSString *_Nonnull)uri;
789 -(void)readLineModelData:(NSString *_Nonnull)uri;
790 
791 @end
792 
793 
794 #endif /* vlSDK_APPLE_h */
795 
Definition: vlSDK_Apple.h:160
Definition: vlSDK_Apple.h:168
Properties of models managed by the visionlib. The model properties can be queried by calling request...
Definition: vlSDK_Apple.h:125
NSString * modelHash
The model hash code for licensing of the model.
Definition: vlSDK_Apple.h:132
NSString * name
The name which has either been automatically assigned, or is coming from the model definitions,...
Definition: vlSDK_Apple.h:135
int subMeshCount
Stats of the model regarding the number of mehes.
Definition: vlSDK_Apple.h:144
int triangleCount
Stats of the model regarding the number of triangles used.
Definition: vlSDK_Apple.h:147
bool occluder
If the model will occlude other parts as an invisible part.
Definition: vlSDK_Apple.h:141
NSString * uri
The URI of the object that has been referenced.
Definition: vlSDK_Apple.h:138
bool enabled
If the model is expected to be shown.
Definition: vlSDK_Apple.h:129
Convenient function for using the vlSDK in a simple manner. @discussion The vlSDK wrapper uses the C-...
Definition: vlSDK_Apple.h:390
Definition: vlSDK_Apple.h:104
Definition: vlSDK_Apple.h:82
Definition: vlSDK_Apple.h:111
Listener for all callbacks of the visionLib.
Definition: vlSDK_Apple.h:184
void onSteppedFrame()
Receive the stepped state. @discussion Will be called, when the SDK has stepped one frame forward....