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 #import <Foundation/Foundation.h>
38 #if defined(__arm__) || defined(__arm64__)
39 #define vlSDKFOR_IPHONE
40 #endif
41 
42 #ifdef vlSDKFOR_IPHONE
43 #import <UIKit/UIKit.h>
44 #endif
45 
46 #import <Metal/Metal.h>
47 #import <CoreImage/CoreImage.h>
48 
49 /*
50 @interface vlCameraDevice:NSObject {
51 @public
52  NSString *deviceID;
53  NSString *internalID;
54  NSString *cameraName;
55  NSString *position;
56  NSString *prefRes;
57 }
58 @end
59 
60 @interface vlDeviceInfo:NSObject {
61 @public
62  NSString *os;
63  NSString *manufacture;
64  NSString *model;
65  NSString *modelVersion;
66  NSString *unifiedID;
67  NSString *internalModelID;
68  NSString *appID;
69  int numberOfProcessors;
70  int nativeResX;
71  int nativeResY;
72  int currentDisplayOrientation;
73  bool usingEventLogger;
74  bool cameraAllowed;
75  NSArray<vlCameraDevice *> *availableCameras;
76 }
77  @end
78 */
79 
87 FOUNDATION_EXPORT @interface vlModelProperties:NSObject {
88 @public
89 
91  bool enabled;
92 
94  NSString *modelHash;
95 
97  NSString *name;
98 
100  NSString *uri;
101 
103  bool occluder;
104 
107 
110 }
111 /*@property (atomic, assign) bool enabled;
112 @property (nonatomic, retain) NSString * _Nonnull modelHash;
113 @property (nonatomic, retain) NSString *_Nonnull name;
114 @property (nonatomic, assign) bool occluder;
115 @property (nonatomic, assign) int subMeshCount;
116 @property (nonatomic, assign) int triangleCount;
117 @property (nonatomic, retain) NSString *_Nonnull uri;
118 */
119 - (NSString *)toString;
120 @end
121 
122 FOUNDATION_EXPORT @interface vlTrackingIssue:NSObject {
123 @public
124  NSString *info;
125  int code;
126  int level;
127 }
128 @end
129 
130 FOUNDATION_EXPORT @interface vlTrackingIssues:NSObject {
131 @public
132  NSArray<vlTrackingIssue *> *issues;
133  NSString *message;
134 }
136 -(BOOL)hasCode:(int)code;
137 
138 @end
139 
147 FOUNDATION_EXPORT @protocol vlFrameListenerInterface <NSObject>
148 
149 @optional
150 
151 //
152 
159 -(NSMutableData * _Nonnull )onGetDebugImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
160 
169 -(void)onRawDebugImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
170 
177 -(void)onMetalDebugImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
178 
185 -(void)onCGDebugImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
186 
187 
188 
196 -(NSMutableData * _Nonnull )onGetImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
197 
206 -(void)onRawImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
207 
216 -(void)onMetalImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
217 
226 -(void)onCGImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
227 
228 
230 
235 -(void)onTrackerInitialized:(bool)worked;
236 
245 -(void)onTrackerInitializedWithWarningIssues:(vlTrackingIssues* _Nullable)warnings andErrors:(vlTrackingIssues* _Nullable)errors;
246 
252 -(void)onExtrinsicData:(float * _Nonnull)data isValid:(bool)valid;
253 
258 -(void)onIntrinsicData:(float * _Nonnull)data;
259 
269 -(void)onIntrinsicDataWithWidth:(float)width height:(float)height cx:(float)cx cy:(float)cy fx:(float)fx fy:(float)fy;
270 
277 -(void)onLog:(NSString * _Nonnull)logString;
278 
283 -(void)onTrackingPaused:(BOOL)worked;
284 
288 -(void)onSteppedFrame;
289 
311 -(void)onTrackingInformation:(NSDictionary* _Nonnull)info;
312 
316 -(void)onInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
317 
321 -(void)onInitPoseMatrix:(float * _Nonnull)m;
322 
327 -(void)onResetTracking:(BOOL)hard;
328 
329 
331 
336 -(void) onCalibrationResults:(NSString * _Nullable)json;
337 
338 
344 -(void) onGetAttribute:(NSString *_Nonnull)name withValue:(NSString *_Nonnull)value;
345 
346 
347 -(void)onModelProperties:(NSArray<vlModelProperties*>* _Nonnull)info;
348 -(void)onModelRemoved:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
349 -(void)onRawModelAdded:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
350 @end
351 
352 
357 FOUNDATION_EXPORT @interface vlSDK : NSObject {
358 }
359 
366 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(id _Nullable)delegate __attribute((deprecated("Use functions that also set licensePath or licenseData")));
367 
375 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(id _Nullable)delegate;
376 
384 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(id _Nullable)delegate;
385 
395 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options __attribute((deprecated("Use functions that also set licensePath or licenseData")));
396 
407 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
408 
419 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
420 
421 
425 - (void) dealloc;
426 
430 - (void) shutDown;
431 
438 -(void) process;
439 
444 -(void)step;
445 
450 -(BOOL) isPaused;
451 
452 
457 -(void) pause:(BOOL)enable;
458 
462 -(void) run;
463 
467 -(void) stop;
468 -(void) start;
469 
470 #ifdef vlSDKFOR_IPHONE
471 
472 
476 -(void) setDeviceOrientation:(UIDeviceOrientation)orientation withWidth:(int)width andHeight:(int)height;
477 #else
478 
482 -(void) windowResized:(CGSize)size;
483 
484 #endif
485 
490 -(void) setLogLevel:(int)level;
491 
496 -(void) setFPS:(unsigned int)fps;
497 
504 -(void) setNearPlane:(float)near andFarPlane:(float)far;
505 
511 -(void) setInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
512 
517 -(void) setInitPoseFromMatrix:(float * _Nonnull)m;
518 
520 
525 -(void) configureExtrinsicCameraInverted:(BOOL)invert;
526 
530 -(void) resetSoft;
531 
537 -(void) resetHard;
538 
542 -(void) getInitPose;
543 
549 -(BOOL) getLastExtrinsic:(float * _Nonnull)m;
550 
556 -(void) applyInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float)angle;
557 
564 -(void) getInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float* _Nonnull)angle;
565 
572 -(BOOL) enableDebugImage;
573 
577 -(BOOL) disableDebugImage;
578 
579 #ifdef vlSDKFOR_IPHONE
580 
583 -(void)startAlignInitPoseWithSensor;
584 
588 -(void)stopAlignInitPoseWithSensor;
589 #endif
590 
591 #ifdef vlSDKFOR_IPHONE
592 
596 -(UIImage * _Nullable)getLastImage;
597 #else
598 
602 -(NSImage * _Nullable) getLastImage;
603 
604 #endif
605 
612 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withFloatValue:(float)value;
613 
620 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withStringValue:(NSString * _Nonnull)value;
621 
627 -(void)getAttributeRequest:(NSString * _Nonnull)attribute;
628 
629 
635 -(void)setCalibrationCommand:(NSString * _Nonnull)command;
636 
642 -(void)writeCalibrationDB:(NSString * _Nonnull)uri;
643 
650 -(NSString * _Nullable)getTrackerType;
651 
665 -(void)writeInitData:(NSString *_Nonnull)uri;
666 
667 
668 
669 
680 -(void)readInitData:(NSString *_Nonnull)uri;
681 
687 -(void)resetInitData;
688 
689 
695 -(void)setModel:(NSString *_Nonnull)name property:(NSString *_Nonnull)property state:(bool)enable;
696 
697 
698 
704 -(void)requestModelProperties;
705 
711 -(void)requestModelData:(NSString*_Nonnull)name withOptions:(NSString *_Nonnull)options;
712 
713 
719 -(void)removeModel:(NSString*_Nonnull)nameURI;
720 
758 -(BOOL)addRawModelWithStruct:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
759 
760 
761 -(void)pushJsonAndBinaryCommand:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
762 -(void)pushJsonCommand:(NSString *_Nonnull)json;
763 -(void)writeLineModelData:(NSString *_Nonnull)uri;
764 -(void)readLineModelData:(NSString *_Nonnull)uri;
765 
766 @end
767 
768 
769 #endif /* vlSDK_APPLE_h */
770 
int subMeshCount
Stats of the model regarding the number of mehes.
Definition: vlSDK_Apple.h:106
NSString * toString()
NSString * info
Definition: vlSDK_Apple.h:124
NSString * modelHash
The model hash code for licensing of the model.
Definition: vlSDK_Apple.h:94
Definition: vlSDK_Apple.h:130
NSString * message
Definition: vlSDK_Apple.h:133
int code
Definition: vlSDK_Apple.h:125
bool enabled
If the model is expected to be shown.
Definition: vlSDK_Apple.h:91
bool occluder
If the model will occlude other parts as an invisible part.
Definition: vlSDK_Apple.h:103
NSArray< vlTrackingIssue * > * issues
Definition: vlSDK_Apple.h:132
Definition: vlSDK_Apple.h:122
Convenient function for using the vlSDK in a simple manner. The vlSDK wrapper uses the C-Interface a...
Definition: vlSDK_Apple.h:357
int level
Definition: vlSDK_Apple.h:126
NSString * name
The name which has either been automatically assigned, or is coming from the model definitions...
Definition: vlSDK_Apple.h:97
int triangleCount
Stats of the model regarding the number of triangles used.
Definition: vlSDK_Apple.h:109
NSString * uri
The URI of the object that has been referenced.
Definition: vlSDK_Apple.h:100
Properties of models managed by the visionlib. The model properties can be queried by calling request...
Definition: vlSDK_Apple.h:87