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 <vlSDK/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  int level;
165 }
166 @end
167 
168 FOUNDATION_EXPORT VL_SDK_API @interface VLIssues:NSObject {
169 @public
170  NSArray<VLIssue *> *issues;
171  NSString *message;
172 }
174 -(BOOL)hasCode:(int)code;
175 
176 @end
177 
185 FOUNDATION_EXPORT VL_SDK_API @protocol vlFrameListenerInterface <NSObject>
186 
187 @optional
188 
189 //
190 
197 -(NSMutableData * _Nonnull )onGetDebugImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
198 
207 -(void)onRawDebugImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
208 
215 -(void)onMetalDebugImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
216 
223 -(void)onCGDebugImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
224 
225 
226 
234 -(NSMutableData * _Nonnull )onGetImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
235 
244 -(void)onRawImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
245 
252 -(void)onMetalImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
253 
260 -(void)onCGImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
261 
262 
264 
269 -(void)onTrackerInitialized:(bool)worked;
270 
279 -(void)onIssuesTriggered:(VLIssues* _Nullable)warnings andErrors:(VLIssues* _Nullable)errors;
280 
286 -(void)onExtrinsicData:(float * _Nonnull)data isValid:(bool)valid;
287 
292 -(void)onIntrinsicData:(float * _Nonnull)data;
293 
303 -(void)onIntrinsicDataWithWidth:(float)width height:(float)height cx:(float)cx cy:(float)cy fx:(float)fx fy:(float)fy;
304 
311 -(void)onLog:(NSString * _Nonnull)logString;
312 
317 -(void)onTrackingPaused:(BOOL)worked;
318 
322 -(void)onSteppedFrame;
323 
345 -(void)onTrackingInformation:(vlTrackingState* _Nonnull)state;
346 
350 -(void)onInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
351 
355 -(void)onInitPoseMatrix:(float * _Nonnull)m;
356 
361 -(void)onResetTracking:(BOOL)hard;
362 
363 
365 
370 -(void) onCalibrationResults:(NSString * _Nullable)json;
371 
372 
378 -(void) onGetAttribute:(NSString *_Nonnull)name withValue:(NSString *_Nonnull)value;
379 
380 
381 -(void)onModelProperties:(NSArray<vlModelProperties*>* _Nonnull)info;
382 -(void)onModelRemoved:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
383 -(void)onRawModelAdded:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
384 @end
385 
386 
391 FOUNDATION_EXPORT VL_SDK_API @interface vlSDK : NSObject {
392 }
393 
400 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(id _Nullable)delegate __attribute((deprecated("Use functions that also set licensePath or licenseData")));
401 
409 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(id _Nullable)delegate;
410 
418 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(id _Nullable)delegate;
419 
429 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options __attribute((deprecated("Use functions that also set licensePath or licenseData")));
430 
441 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
442 
453 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
454 
455 
459 - (void) dealloc;
460 
464 - (void) shutDown;
465 
472 -(void) process;
473 
478 -(void)step;
479 
484 -(BOOL) isPaused;
485 
486 
491 -(void) pause:(BOOL)enable;
492 
496 -(void) run;
497 
501 -(void) stop;
502 -(void) start;
503 
504 #ifdef vlSDKFOR_IPHONE
505 
506 
510 -(void) setDeviceOrientation:(UIDeviceOrientation)orientation withWidth:(int)width andHeight:(int)height;
511 #else
512 
516 -(void) windowResized:(CGSize)size;
517 
518 #endif
519 
524 -(void) setLogLevel:(int)level;
525 
530 -(void) setFPS:(unsigned int)fps;
531 
538 -(void) setNearPlane:(float)near andFarPlane:(float)far;
539 
545 -(void) setInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
546 
551 -(void) setInitPoseFromMatrix:(float * _Nonnull)m;
552 
554 
559 -(void) configureExtrinsicCameraInverted:(BOOL)invert;
560 
564 -(void) resetSoft;
565 
571 -(void) resetHard;
572 
576 -(void) getInitPose;
577 
583 -(BOOL) getLastExtrinsic:(float * _Nonnull)m;
584 
590 -(void) applyInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float)angle;
591 
598 -(void) getInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float* _Nonnull)angle;
599 
606 -(BOOL) enableDebugImage;
607 
611 -(BOOL) disableDebugImage;
612 
613 #ifdef vlSDKFOR_IPHONE
617 -(void)startAlignInitPoseWithSensor;
618 
622 -(void)stopAlignInitPoseWithSensor;
623 #endif
624 
625 #ifdef vlSDKFOR_IPHONE
626 
630 -(UIImage * _Nullable)getLastImage;
631 #else
632 
636 -(NSImage * _Nullable) getLastImage;
637 
638 #endif
639 
646 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withFloatValue:(float)value;
647 
654 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withStringValue:(NSString * _Nonnull)value;
655 
661 -(void)getAttributeRequest:(NSString * _Nonnull)attribute;
662 
663 
669 -(void)setCalibrationCommand:(NSString * _Nonnull)command;
670 
676 -(void)writeCalibrationDB:(NSString * _Nonnull)uri;
677 
684 -(NSString * _Nullable)getTrackerType;
685 
692 -(NSString * _Nullable)getDeviceType;
693 
705 -(void)writeInitData:(NSString *_Nonnull)uri;
706 
707 
708 
709 
717 -(void)readInitData:(NSString *_Nonnull)uri;
718 
722 -(void)resetInitData;
723 
724 
728 -(void)setModel:(NSString *_Nonnull)name property:(NSString *_Nonnull)property state:(bool)enable;
729 
730 
731 
735 -(void)requestModelProperties;
736 
740 -(void)requestModelData:(NSString*_Nonnull)name withOptions:(NSString *_Nonnull)options;
741 
742 
746 -(void)removeModel:(NSString*_Nonnull)nameURI;
747 
784 -(BOOL)addRawModelWithStruct:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
785 
786 
787 -(void)pushJsonAndBinaryCommand:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
788 -(void)pushJsonCommand:(NSString *_Nonnull)json;
789 -(void)writeLineModelData:(NSString *_Nonnull)uri;
790 -(void)readLineModelData:(NSString *_Nonnull)uri;
791 
792 @end
793 
794 
795 #endif /* vlSDK_APPLE_h */
796 
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:391
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:185
void onSteppedFrame()
Receive the stepped state. @discussion Will be called, when the SDK has stepped one frame forward....