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  float _Total3DFeatureCount;
93  int _NumberOfPatternRecognitions;
94  int _NumberOfTemplates;
95  int _NumberOfTemplatesDynamic;
96  int _NumberOfTemplatesStatic;
97  int _NumberOfLineModels;
98  float _AutoInitSetupProgress;
99  int _TrackingImageWidth;
100  int _TrackingImageHeight;
101  double timeStamp;
102 }
103 @end
104 
105 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingDeviceState:NSObject {
106 @public
107  NSString* name;
108  NSString* _WorldMappingStatus;
109 }
110 @end
111 
112 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingState:NSObject {
113 @public
114  NSArray<vlTrackingObjectState*>* objects;
115  NSArray<vlTrackingDeviceState*>* inputs;
116 }
117 @end
118 
126 FOUNDATION_EXPORT VL_SDK_API @interface vlModelProperties:NSObject {
127 @public
128 
130  bool enabled;
131 
133  NSString *modelHash;
134 
136  NSString *name;
137 
139  NSString *uri;
140 
142  bool occluder;
143 
146 
149 }
150 /*@property (atomic, assign) bool enabled;
151 @property (nonatomic, retain) NSString * _Nonnull modelHash;
152 @property (nonatomic, retain) NSString *_Nonnull name;
153 @property (nonatomic, assign) bool occluder;
154 @property (nonatomic, assign) int subMeshCount;
155 @property (nonatomic, assign) int triangleCount;
156 @property (nonatomic, retain) NSString *_Nonnull uri;
157 */
158 - (NSString *)toString;
159 @end
160 
161 FOUNDATION_EXPORT VL_SDK_API @interface VLIssue:NSObject {
162 @public
163  NSString *info;
164  int code;
165  int level;
166 }
167 @end
168 
169 FOUNDATION_EXPORT VL_SDK_API @interface VLIssues:NSObject {
170 @public
171  NSArray<VLIssue *> *issues;
172  NSString *message;
173 }
175 -(BOOL)hasCode:(int)code;
176 
177 @end
178 
186 FOUNDATION_EXPORT VL_SDK_API @protocol vlFrameListenerInterface <NSObject>
187 
188 @optional
189 
190 //
191 
198 -(NSMutableData * _Nonnull )onGetDebugImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
199 
208 -(void)onRawDebugImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
209 
216 -(void)onMetalDebugImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
217 
224 -(void)onCGDebugImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
225 
226 
227 
235 -(NSMutableData * _Nonnull )onGetImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
236 
245 -(void)onRawImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
246 
255 -(void)onMetalImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
256 
265 -(void)onCGImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
266 
267 
269 
274 -(void)onTrackerInitialized:(bool)worked;
275 
284 -(void)onIssuesTriggered:(VLIssues* _Nullable)warnings andErrors:(VLIssues* _Nullable)errors;
285 
291 -(void)onExtrinsicData:(float * _Nonnull)data isValid:(bool)valid;
292 
297 -(void)onIntrinsicData:(float * _Nonnull)data;
298 
308 -(void)onIntrinsicDataWithWidth:(float)width height:(float)height cx:(float)cx cy:(float)cy fx:(float)fx fy:(float)fy;
309 
316 -(void)onLog:(NSString * _Nonnull)logString;
317 
322 -(void)onTrackingPaused:(BOOL)worked;
323 
327 -(void)onSteppedFrame;
328 
350 -(void)onTrackingInformation:(vlTrackingState* _Nonnull)state;
351 
355 -(void)onInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
356 
360 -(void)onInitPoseMatrix:(float * _Nonnull)m;
361 
366 -(void)onResetTracking:(BOOL)hard;
367 
368 
370 
375 -(void) onCalibrationResults:(NSString * _Nullable)json;
376 
377 
383 -(void) onGetAttribute:(NSString *_Nonnull)name withValue:(NSString *_Nonnull)value;
384 
385 
386 -(void)onModelProperties:(NSArray<vlModelProperties*>* _Nonnull)info;
387 -(void)onModelRemoved:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
388 -(void)onRawModelAdded:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
389 @end
390 
391 
396 FOUNDATION_EXPORT VL_SDK_API @interface vlSDK : NSObject {
397 }
398 
405 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(id _Nullable)delegate __attribute((deprecated("Use functions that also set licensePath or licenseData")));
406 
414 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(id _Nullable)delegate;
415 
423 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(id _Nullable)delegate;
424 
434 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options __attribute((deprecated("Use functions that also set licensePath or licenseData")));
435 
446 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
447 
458 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
459 
460 
464 - (void) dealloc;
465 
469 - (void) shutDown;
470 
477 -(void) process;
478 
483 -(void)step;
484 
489 -(BOOL) isPaused;
490 
491 
496 -(void) pause:(BOOL)enable;
497 
501 -(void) run;
502 
506 -(void) stop;
507 -(void) start;
508 
509 #ifdef vlSDKFOR_IPHONE
510 
511 
515 -(void) setDeviceOrientation:(UIDeviceOrientation)orientation withWidth:(int)width andHeight:(int)height;
516 #else
517 
521 -(void) windowResized:(CGSize)size;
522 
523 #endif
524 
529 -(void) setLogLevel:(int)level;
530 
535 -(void) setFPS:(unsigned int)fps;
536 
543 -(void) setNearPlane:(float)near andFarPlane:(float)far;
544 
550 -(void) setInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
551 
556 -(void) setInitPoseFromMatrix:(float * _Nonnull)m;
557 
559 
564 -(void) configureExtrinsicCameraInverted:(BOOL)invert;
565 
569 -(void) resetSoft;
570 
576 -(void) resetHard;
577 
581 -(void) getInitPose;
582 
588 -(BOOL) getLastExtrinsic:(float * _Nonnull)m;
589 
595 -(void) applyInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float)angle;
596 
603 -(void) getInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float* _Nonnull)angle;
604 
611 -(BOOL) enableDebugImage;
612 
616 -(BOOL) disableDebugImage;
617 
618 #ifdef vlSDKFOR_IPHONE
619 
622 -(void)startAlignInitPoseWithSensor;
623 
627 -(void)stopAlignInitPoseWithSensor;
628 #endif
629 
630 #ifdef vlSDKFOR_IPHONE
631 
635 -(UIImage * _Nullable)getLastImage;
636 #else
637 
641 -(NSImage * _Nullable) getLastImage;
642 
643 #endif
644 
651 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withFloatValue:(float)value;
652 
659 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withStringValue:(NSString * _Nonnull)value;
660 
666 -(void)getAttributeRequest:(NSString * _Nonnull)attribute;
667 
668 
674 -(void)setCalibrationCommand:(NSString * _Nonnull)command;
675 
681 -(void)writeCalibrationDB:(NSString * _Nonnull)uri;
682 
689 -(NSString * _Nullable)getTrackerType;
690 
697 -(NSString * _Nullable)getDeviceType;
698 
712 -(void)writeInitData:(NSString *_Nonnull)uri;
713 
714 
715 
716 
727 -(void)readInitData:(NSString *_Nonnull)uri;
728 
734 -(void)resetInitData;
735 
736 
742 -(void)setModel:(NSString *_Nonnull)name property:(NSString *_Nonnull)property state:(bool)enable;
743 
744 
745 
751 -(void)requestModelProperties;
752 
758 -(void)requestModelData:(NSString*_Nonnull)name withOptions:(NSString *_Nonnull)options;
759 
760 
766 -(void)removeModel:(NSString*_Nonnull)nameURI;
767 
805 -(BOOL)addRawModelWithStruct:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
806 
807 
808 -(void)pushJsonAndBinaryCommand:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
809 -(void)pushJsonCommand:(NSString *_Nonnull)json;
810 -(void)writeLineModelData:(NSString *_Nonnull)uri;
811 -(void)readLineModelData:(NSString *_Nonnull)uri;
812 
813 @end
814 
815 
816 #endif /* vlSDK_APPLE_h */
817 
int subMeshCount
Stats of the model regarding the number of mehes.
Definition: vlSDK_Apple.h:145
NSString * modelHash
The model hash code for licensing of the model.
Definition: vlSDK_Apple.h:133
bool enabled
If the model is expected to be shown.
Definition: vlSDK_Apple.h:130
Definition: vlSDK_Apple.h:105
Definition: vlSDK_Apple.h:161
bool occluder
If the model will occlude other parts as an invisible part.
Definition: vlSDK_Apple.h:142
Definition: vlSDK_Apple.h:112
Convenient function for using the vlSDK in a simple manner. The vlSDK wrapper uses the C-Interface a...
Definition: vlSDK_Apple.h:396
NSString * name
The name which has either been automatically assigned, or is coming from the model definitions...
Definition: vlSDK_Apple.h:136
int triangleCount
Stats of the model regarding the number of triangles used.
Definition: vlSDK_Apple.h:148
VLIssues stores the issues arrising during startup More information on possible codes: Initialization...
Definition: vlSDK_Apple.h:169
NSString * uri
The URI of the object that has been referenced.
Definition: vlSDK_Apple.h:139
Definition: vlSDK_Apple.h:82
Properties of models managed by the visionlib. The model properties can be queried by calling request...
Definition: vlSDK_Apple.h:126