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 
41 #include <TargetConditionals.h>
42 
43 #if TARGET_OS_IOS
44 #import <UIKit/UIKit.h>
45 #endif
46 
47 #import <Metal/Metal.h>
48 #import <CoreImage/CoreImage.h>
49 
50 /*
51 @interface vlCameraDevice:NSObject {
52 @public
53  NSString *deviceID;
54  NSString *internalID;
55  NSString *cameraName;
56  NSString *position;
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  NSArray<vlCameraDevice *> *availableCameras;
75 }
76  @end
77 */
78 
79 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingObjectState:NSObject {
80 @public
81  NSString* name;
82  NSString* state;
83  float quality;
84  float _InitInlierRatio;
85  int _InitNumOfCorresp;
86  float _TrackingInlierRatio;
87  int _TrackingNumOfCorresp;
88  float _SFHFrameDist;
89  int _NumberOfPatternRecognitions;
90  int _NumberOfTemplates;
91  int _NumberOfTemplatesDynamic;
92  int _NumberOfTemplatesStatic;
93  int _NumberOfLineModels;
94  float _AutoInitSetupProgress;
95  int _TrackingImageWidth;
96  int _TrackingImageHeight;
97  double timeStamp;
98 }
99 @end
100 
101 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingDeviceState:NSObject {
102 @public
103  NSString* name;
104  NSString* _WorldMappingStatus;
105 }
106 @end
107 
108 FOUNDATION_EXPORT VL_SDK_API @interface vlTrackingState:NSObject {
109 @public
110  NSArray<vlTrackingObjectState*>* objects;
111  NSArray<vlTrackingDeviceState*>* inputs;
112 }
113 @end
114 
122 FOUNDATION_EXPORT VL_SDK_API @interface vlModelProperties:NSObject {
123 @public
124 
126  bool enabled;
127 
129  NSString *modelHash;
130 
132  NSString *name;
133 
135  NSString *uri;
136 
138  bool occluder;
139 
142 
145 }
146 /*@property (atomic, assign) bool enabled;
147 @property (nonatomic, retain) NSString * _Nonnull modelHash;
148 @property (nonatomic, retain) NSString *_Nonnull name;
149 @property (nonatomic, assign) bool occluder;
150 @property (nonatomic, assign) int subMeshCount;
151 @property (nonatomic, assign) int triangleCount;
152 @property (nonatomic, retain) NSString *_Nonnull uri;
153 */
154 - (NSString * _Nullable)toString;
155 @end
156 
157 FOUNDATION_EXPORT VL_SDK_API @interface VLIssue:NSObject {
158 @public
159  NSString *info;
160  int code;
161  NSString *message;
162 }
163 @end
164 
165 FOUNDATION_EXPORT VL_SDK_API @interface VLIssues:NSObject {
166 @public
167  NSArray<VLIssue *> *issues;
168 }
170 -(BOOL)hasCode:(int)code;
171 
172 @end
173 
181 FOUNDATION_EXPORT VL_SDK_API @protocol vlFrameListenerInterface <NSObject>
182 
183 @optional
184 
185 //
186 
193 -(NSMutableData * _Nonnull )onGetDebugImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
194 
203 -(void)onRawDebugImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
204 
211 -(void)onMetalDebugImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
212 
219 -(void)onCGDebugImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
220 
221 
222 
230 -(NSMutableData * _Nonnull )onGetImageBufferWithWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
231 
240 -(void)onRawImageBuffer:(NSData * _Nonnull)data withWidth:(int)width andHeight:(int)height andBytesPerPixel:(int)bytesPerPixel;
241 
248 -(void)onMetalImageTexture:(_Nonnull id<MTLTexture>)texture withRotationMatrix:(float * _Nonnull)m;
249 
256 -(void)onCGImageRef:(CGImageRef _Nonnull)texture withRotationMatrix:(float * _Nonnull)m;
257 
258 
260 
265 -(void)onTrackerInitialized:(bool)worked;
266 
275 -(void)onIssuesTriggered:(VLIssues* _Nullable)warnings andErrors:(VLIssues* _Nullable)errors;
276 
282 -(void)onExtrinsicData:(float * _Nonnull)data isValid:(bool)valid;
283 
288 -(void)onIntrinsicData:(float * _Nonnull)data;
289 
299 -(void)onIntrinsicDataWithWidth:(float)width height:(float)height cx:(float)cx cy:(float)cy fx:(float)fx fy:(float)fy;
300 
307 -(void)onLog:(NSString * _Nonnull)logString;
308 
313 -(void)onTrackingPaused:(BOOL)worked;
314 
318 -(void)onSteppedFrame;
319 
341 -(void)onTrackingInformation:(vlTrackingState* _Nonnull)state;
342 
346 -(void)onInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
347 
351 -(void)onInitPoseMatrix:(float * _Nonnull)m;
352 
357 -(void)onResetTracking:(BOOL)hard;
358 
359 
361 
366 -(void) onCalibrationResults:(NSString * _Nullable)json;
367 
368 
374 -(void) onGetAttribute:(NSString *_Nonnull)name withValue:(NSString *_Nonnull)value;
375 
376 
377 -(void)onModelProperties:(NSArray<vlModelProperties*>* _Nonnull)info;
378 -(void)onModelRemoved:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
379 -(void)onRawModelAdded:(NSString * _Nullable)json withError:(NSString * _Nullable)errorJson;
380 @end
381 
382 
387 FOUNDATION_EXPORT VL_SDK_API @interface vlSDK : NSObject {
388 }
389 
396 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(id _Nullable)delegate __attribute((deprecated("Use functions that also set licensePath or licenseData")));
397 
405 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(id _Nullable)delegate;
406 
414 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(id _Nullable)delegate;
415 
425 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options __attribute((deprecated("Use functions that also set licensePath or licenseData")));
426 
437 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicensePath:(NSString* _Nonnull)licensePath andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
438 
449 -(id _Nonnull) initTrackerWithURI:(NSString* _Nonnull)uri andLicenseData:(NSString* _Nonnull)licenseData andDelegate:(_Nullable id)delegate withOptions:(NSDictionary * _Nullable)options;
450 
451 
455 - (void) dealloc;
456 
460 - (void) shutDown;
461 
468 -(void) process;
469 
474 -(void)step;
475 
480 -(BOOL) isPaused;
481 
482 
487 -(void) pause:(BOOL)enable;
488 
492 -(void) run;
493 
497 -(void) stop;
498 -(void) start;
499 
500 #if TARGET_OS_IOS
501 
502 
506 -(void) setDeviceOrientation:(UIDeviceOrientation)orientation withWidth:(int)width andHeight:(int)height;
507 #else
508 
512 -(void) windowResized:(CGSize)size;
513 
514 #endif
515 
520 -(void) setLogLevel:(int)level;
521 
526 -(void) setFPS:(unsigned int)fps;
527 
534 -(void) setNearPlane:(float)near andFarPlane:(float)far;
535 
541 -(void) setInitPose:(float * _Nonnull)t andQ:(float* _Nonnull)q;
542 
547 -(void) setInitPoseFromMatrix:(float * _Nonnull)m;
548 
550 
555 -(void) configureExtrinsicCameraInverted:(BOOL)invert;
556 
560 -(void) resetSoft;
561 
567 -(void) resetHard;
568 
572 -(void) getInitPose;
573 
579 -(BOOL) getLastExtrinsic:(float * _Nonnull)m;
580 
586 -(void) applyInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float)angle;
587 
594 -(void) getInitPoseCorrectionWithAxis:(float* _Nonnull)axis andAngle:(float* _Nonnull)angle;
595 
602 -(BOOL) enableDebugImage;
603 
607 -(BOOL) disableDebugImage;
608 
609 #if TARGET_OS_IOS
610 
613 -(void)startAlignInitPoseWithSensor;
614 
618 -(void)stopAlignInitPoseWithSensor;
619 #endif
620 
621 #if TARGET_OS_IOS
622 
626 -(UIImage * _Nullable)getLastImage;
627 #else
628 
632 -(NSImage * _Nullable) getLastImage;
633 
634 #endif
635 
642 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withFloatValue:(float)value;
643 
650 -(void)setAttributeCommand:(NSString * _Nonnull)attribute withStringValue:(NSString * _Nonnull)value;
651 
657 -(void)getAttributeRequest:(NSString * _Nonnull)attribute;
658 
659 
665 -(void)setCalibrationCommand:(NSString * _Nonnull)command;
666 
672 -(void)writeCalibrationDB:(NSString * _Nonnull)uri;
673 
680 -(NSString * _Nullable)getTrackerType;
681 
688 -(NSString * _Nullable)getDeviceType;
689 
701 -(void)writeInitData:(NSString *_Nonnull)uri;
702 
703 
704 
705 
713 -(void)readInitData:(NSString *_Nonnull)uri;
714 
718 -(void)resetInitData;
719 
720 
724 -(void)setModel:(NSString *_Nonnull)name property:(NSString *_Nonnull)property state:(bool)enable;
725 
726 
727 
731 -(void)requestModelProperties;
732 
736 -(void)requestModelData:(NSString*_Nonnull)name withOptions:(NSString *_Nonnull)options;
737 
738 
742 -(void)removeModel:(NSString*_Nonnull)nameURI;
743 
780 -(BOOL)addRawModelWithStruct:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
781 
782 
783 -(void)pushJsonAndBinaryCommand:(NSString *_Nonnull)struc andData:(NSData*_Nonnull)data;
784 -(void)pushJsonCommand:(NSString *_Nonnull)json;
785 -(void)writeLineModelData:(NSString *_Nonnull)uri;
786 -(void)readLineModelData:(NSString *_Nonnull)uri;
787 
788 @end
789 
790 
791 #endif /* vlSDK_APPLE_h */
792 
int subMeshCount
Stats of the model regarding the number of mehes.
Definition: vlSDK_Apple.h:141
NSString * modelHash
The model hash code for licensing of the model.
Definition: vlSDK_Apple.h:129
bool enabled
If the model is expected to be shown.
Definition: vlSDK_Apple.h:126
Definition: vlSDK_Apple.h:101
Definition: vlSDK_Apple.h:157
bool occluder
If the model will occlude other parts as an invisible part.
Definition: vlSDK_Apple.h:138
Definition: vlSDK_Apple.h:108
Convenient function for using the vlSDK in a simple manner. The vlSDK wrapper uses the C-Interface a...
Definition: vlSDK_Apple.h:387
NSString * name
The name which has either been automatically assigned, or is coming from the model definitions...
Definition: vlSDK_Apple.h:132
int triangleCount
Stats of the model regarding the number of triangles used.
Definition: vlSDK_Apple.h:144
Definition: vlSDK_Apple.h:165
NSString * uri
The URI of the object that has been referenced.
Definition: vlSDK_Apple.h:135
Definition: vlSDK_Apple.h:79
Properties of models managed by the visionlib. The model properties can be queried by calling request...
Definition: vlSDK_Apple.h:122