forked from thecaptury/RemoteCaptury
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RemoteCaptury.h
736 lines (576 loc) · 24.9 KB
/
RemoteCaptury.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
#pragma once
#include <stdint.h>
#include "captury/PublicStructs.h"
#ifdef WIN32
#define CAPTURY_DLL_EXPORT __declspec(dllexport)
#else
#define CAPTURY_DLL_EXPORT
#endif
#ifdef __cplusplus
extern "C" {
#endif
// returns 1 if successful, 0 otherwise
// the default port is 2101
CAPTURY_DLL_EXPORT int Captury_connect(const char* ip, unsigned short port);
// in case you need to set the local port because of firewalls, etc.
// use 0 for localPort and localStreamPort if you don't care
CAPTURY_DLL_EXPORT int Captury_connect2(const char* ip, unsigned short port, unsigned short localPort, unsigned short localStreamPort);
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_disconnect();
// returns the number of actors
// on exit *cameras points to an array of CapturyCamera
// the array is owned by the library - do not free
CAPTURY_DLL_EXPORT int Captury_getActors(const CapturyActor** actors);
// returns the actor or NULL if it is not known
// the struct is owned by the library - do not free
CAPTURY_DLL_EXPORT const CapturyActor* Captury_getActor(int actorId);
// returns the number of cameras
// on exit *cameras points to an array of CapturyCamera
// the array is owned by the library - do not free
CAPTURY_DLL_EXPORT int Captury_getCameras(const CapturyCamera** cameras);
#define CAPTURY_STREAM_NOTHING 0x0000
#define CAPTURY_STREAM_POSES 0x0001
#define CAPTURY_STREAM_GLOBAL_POSES 0x0001
#define CAPTURY_STREAM_LOCAL_POSES 0x0003
#define CAPTURY_STREAM_ARTAGS 0x0004
#define CAPTURY_STREAM_IMAGES 0x0008
#define CAPTURY_STREAM_META_DATA 0x0010 // only valid when streaming poses
#define CAPTURY_STREAM_IMU_DATA 0x0020
#define CAPTURY_STREAM_LATENCY_INFO 0x0040
#define CAPTURY_STREAM_FOOT_CONTACT 0x0080
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_startStreaming(int what);
// if you want to stream images use this function rather than Captury_startStreaming()
// returns 1 if successfull otherwise 0
CAPTURY_DLL_EXPORT int Captury_startStreamingImages(int what, int32_t cameraId);
// equivalent to Captury_startStreaming(CAPTURY_STREAM_NOTHING)
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_stopStreaming();
// fills the pose with the current pose for the given actor
// returns the current pose. Captury_freePose() after use
CAPTURY_DLL_EXPORT CapturyPose* Captury_getCurrentPoseForActor(int actorId);
CAPTURY_DLL_EXPORT CapturyPose* Captury_getCurrentPoseAndTrackingConsistencyForActor(int actorId, int* tc);
CAPTURY_DLL_EXPORT CapturyPose* Captury_getCurrentPose(int actorId);
CAPTURY_DLL_EXPORT CapturyPose* Captury_getCurrentPoseAndTrackingConsistency(int actorId, int* tc);
// simple function for releasing memory of a pose
CAPTURY_DLL_EXPORT void Captury_freePose(CapturyPose* pose);
typedef void (*CapturyNewPoseCallback)(CapturyActor*, CapturyPose*, int trackingQuality);
// register callback that will be called when a new pose is received
// the callback will be run in a different thread than the main application
// try to be quick in the callback
// returns 1 if successful otherwise 0
CAPTURY_DLL_EXPORT int Captury_registerNewPoseCallback(CapturyNewPoseCallback callback);
typedef enum { ACTOR_SCALING, ACTOR_TRACKING, ACTOR_STOPPED, ACTOR_DELETED } CapturyActorStatus;
extern const char* CapturyActorStatusString[];
typedef void (*CapturyActorChangedCallback)(int actorId, int mode);
// register callback that will be called when a new actor is found or
// the status of an existing actor changes
// status can be one of CapturyActorStatus
// returns 1 if successful otherwise 0
CAPTURY_DLL_EXPORT int Captury_registerActorChangedCallback(CapturyActorChangedCallback callback);
typedef void (*CapturyARTagCallback)(int num, CapturyARTag*);
// register callback that will be called when an artag is detected
// pass NULL if you want to deregister the callback
// returns 1 if successful otherwise 0
CAPTURY_DLL_EXPORT int Captury_registerARTagCallback(CapturyARTagCallback callback);
// returns an array of artags followed by one where the id is -1
// Captury_freeARTags() after use
CAPTURY_DLL_EXPORT CapturyARTag* Captury_getCurrentARTags();
CAPTURY_DLL_EXPORT void Captury_freeARTags(CapturyARTag* artags);
// do NOT free the image
typedef void (*CapturyImageCallback)(const CapturyImage* img);
// register callback that will be called when a new frame was streamed from this particular camera
// pass NULL to deregister
// returns 1 if successfull otherwise 0
CAPTURY_DLL_EXPORT int Captury_registerImageStreamingCallback(CapturyImageCallback callback);
// may return NULL if no image has been received yet
// use Captury_freeImage to free after use
CAPTURY_DLL_EXPORT CapturyImage* Captury_getCurrentImage();
// requests an update of the texture for the given actor. non-blocking
// returns 1 if successful otherwise 0
CAPTURY_DLL_EXPORT int Captury_requestTexture(int actorId);
// returns the timestamp of the constraint or 0
CAPTURY_DLL_EXPORT uint64_t Captury_getMarkerTransform(int actorId, int joint, CapturyTransform* trafo);
// get the scaling status (0 - 100)
CAPTURY_DLL_EXPORT int Captury_getScalingProgress(int actorId);
// get the tracking quality (0 - 100)
CAPTURY_DLL_EXPORT int Captury_getTrackingQuality(int actorId);
// change the name of the actor
CAPTURY_DLL_EXPORT int Captury_setActorName(int actorId, const char* name);
// returns a texture image of the specified actor. free after use with Captury_freeImage().
CAPTURY_DLL_EXPORT CapturyImage* Captury_getTexture(int actorId);
// simple function for releasing memory of a pose
CAPTURY_DLL_EXPORT void Captury_freeImage(CapturyImage* image);
// synchronizes time with Captury Live
// this function should be called once before calling Captury_getTime()
// returns the current time in microseconds
CAPTURY_DLL_EXPORT uint64_t Captury_synchronizeTime();
// returns the current time as measured by Captury Live in microseconds
CAPTURY_DLL_EXPORT uint64_t Captury_getTime();
// returns the difference between the local and the remote time in microseconds
CAPTURY_DLL_EXPORT int64_t Captury_getTimeOffset();
// get the last error message
CAPTURY_DLL_EXPORT char* Captury_getLastErrorMessage();
CAPTURY_DLL_EXPORT void Captury_freeErrorMessage(char* msg);
// tries to snap an actor at the specified location
// x and z are in mm
// heading is in degrees measured from the x-axis around the y-axis (270 is facing the z-axis)
// use a value larger than 360 to indicate that heading is not known
// poll Captury_getActors to get the new actor id
// returns 1 if the request was successfully received
CAPTURY_DLL_EXPORT int Captury_snapActor(float x, float z, float heading);
// tries to snap an actor at the specified location just like Captury_snapActor()
// the additional parameters allow specifying which skeleton should be snapped (the name should match the name in the drop down)
// snapMethod should be one of CapturySnapMethod
// if quickScaling != 0 snapping uses only a single frame
// returns 1 on success, 0 otherwise
typedef enum { SNAP_BACKGROUND_LOCAL, SNAP_BACKGROUND_GLOBAL, SNAP_BODYPARTS_LOCAL, SNAP_BODYPARTS_GLOBAL, SNAP_BODYPARTS_JOINTS, SNAP_DEFAULT } CapturySnapMethod;
CAPTURY_DLL_EXPORT int Captury_snapActorEx(float x, float z, float radius, float heading, const char* skeletonName, int snapMethod, int quickScaling);
// (re-)start tracking the actor at the given location
// x and z are in mm
// heading is in degrees measured from the x-axis around the y-axis (270 is facing the z-axis)
// use a value larger than 360 to indicate that heading is not known
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_startTracking(int actorId, float x, float z, float heading);
// stops tracking the specified actor
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_stopTracking(int actorId);
// stops tracking the actor and deletes the corresponding internal data in CapturyLive
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_deleteActor(int actorId);
// rescale actor
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_rescaleActor(int actorId);
// recolor actor
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_recolorActor(int actorId);
// recolor actor
// returns 1 on success, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_updateActorColors(int actorId);
#define CAPTURY_CONSTRAINT_HALF_PLANE 1
#define CAPTURY_CONSTRAINT_ROTATION 2
#define CAPTURY_CONSTRAINT_FIXED_AXIS 4
#define CAPTURY_CONSTRAINT_DISTANCE 8
#define CAPTURY_CONSTRAINT_OFFSET 16
// constrain point attached to joint to stay on one side of the half plane defined by normal, offset
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setHalfplaneConstraint(int actorId, int jointIndex, float* originOffset, float* normal, float offset, uint64_t timestamp, float weight);
// constrain bone to point in specific direction given by x,y,z Euler angles in *rotation
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setRotationConstraint(int actorId, int jointIndex, float* rotation, uint64_t timestamp, float weight);
// constrain axis attached to joint to point in the direction of targetAxis
// unlike the rotation constraint this constraint allows the bone to rotate around the targetAxis
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setFixedAxisConstraint(int actorId, int jointIndex, float* axis, float* targetAxis, uint64_t timestamp, float weight);
// constrain a point attached to a joint of originActorId to maintain an offset to a point attached to a joint on targetActorId
// the offset is specified in local coordinates of the origin actor
// this constraint could for example be used to constrain the hands of a cyclist to maintain their relative position on the handle bars
// originActor and targetActor are allowed to be identical
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setOffsetConstraint(int originActorId, int originJointIndex, float* originOffset, int targetActorId, int targetJointIndex, float* targetOffset, float* offset, uint64_t timestamp, float weight);
// constrain a point attached to a joint of originActorId to maintain a given distance to a point attached to a joint on targetActorId
// originActor and targetActor are allowed to be identical
// this constraint could for example be used to constrain the feet of a cyclist to maintain a constant distance
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setDistanceConstraint(int originActorId, int originJointIndex, float* originOffset, int targetActorId, int targetJointIndex, float* targetOffset, float distance, uint64_t timestamp, float weight);
// constrain a point attached to a joint of originActorId to maintain a relative rotation to a point attached to a joint on targetActorId
// originActor and targetActor are allowed to be identical
// weight should nornally be 1
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setRelativeRotationConstraint(int originActorId, int originJointIndex, int targetActorId, int targetJointIndex, float* rotation, uint64_t timestamp, float weight);
// fills the pointers with the current day, session, shot tuple that is used in CapturyLive to identify a shot
// the strings are owned by the library - do not free or overwrite
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_getCurrentDaySessionShot(const char** day, const char** session, const char** shot);
// sets the shot name for the next recording
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_setShotName(const char* name);
// you have to set the shot name before starting to record - or make sure that it has been set using CapturyLive
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_startRecording();
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_stopRecording();
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_getCurrentLatency(CapturyLatencyInfo* latencyInfo);
typedef void (*CapturyCustomPacketCallback)(int size, const void* data);
// send packet with any data to Captury Live
// the packet will be handled by a plugin that registered for receiving packets with this name
// the name must be at most 16 characters
// size is the size of the raw data without the name of the plugin
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_sendCustomPacket(const char* pluginName, int size, const void* data);
// register callback that will be called when a packet with the given name is received
// the name must be at most 16 characters including a terminating 0
// the callback will be run in a different thread than the main application
// try to be quick in the callback
// returns 1 if successful, 0 otherwise
CAPTURY_DLL_EXPORT int Captury_registerCustomPacketCallback(const char* pluginName, CapturyCustomPacketCallback callback);
// convert the pose given in global coordinates into local coordinates
CAPTURY_DLL_EXPORT void Captury_convertPoseToLocal(CapturyPose* pose, int actorId);
typedef void (*CapturyBackgroundFinishedCallback)(void* userData);
CAPTURY_DLL_EXPORT int Captury_captureBackground(CapturyBackgroundFinishedCallback callback, void* userData);
CAPTURY_DLL_EXPORT int Captury_getBackgroundQuality();
CAPTURY_DLL_EXPORT const char* Captury_getStatus(); // do not free.
//
// it is safe to ignore everything below this line
//
typedef enum { capturyActors = 1, capturyActor = 2,
capturyCameras = 3, capturyCamera = 4,
capturyStream = 5, capturyStreamAck = 6, capturyPose = 7,
capturyDaySessionShot = 8, capturySetShot = 9, capturySetShotAck = 10,
capturyStartRecording = 11, capturyStartRecordingAck = 12,
capturyStopRecording = 13, capturyStopRecordingAck = 14,
capturyConstraint = 15,
capturyGetTime = 16, capturyTime = 17,
capturyCustom = 18, capturyCustomAck = 19,
capturyGetImage = 20, capturyImageHeader = 21, capturyImageData = 22,
capturyGetImageData = 23,
capturyActorContinued = 24,
capturyGetMarkerTransform = 25, capturyMarkerTransform = 26,
capturyGetScalingProgress = 27, capturyScalingProgress = 28,
capturyConstraintAck = 29,
capturySnapActor = 30, capturyStopTracking = 31, capturyDeleteActor = 32,
capturySnapActorAck = 33, capturyStopTrackingAck = 34, capturyDeleteActorAck = 35,
capturyActorModeChanged = 36, capturyARTag = 37,
capturyGetBackgroundQuality = 38, capturyBackgroundQuality = 39,
capturyCaptureBackground = 40, capturyCaptureBackgroundAck = 41, capturyBackgroundFinished = 42,
capturySetActorName = 43, capturySetActorNameAck = 44,
capturyStreamedImageHeader = 45, capturyStreamedImageData = 46,
capturyGetStreamedImageData = 47, capturyRescaleActor = 48, capturyRecolorActor = 49,
capturyRescaleActorAck = 50, capturyRecolorActorAck = 51,
capturyStartTracking = 52, capturyStartTrackingAck = 53,
capturyPose2 = 54,
capturyGetStatus = 55, capturyStatus = 56,
capturyUpdateActorColors = 57,
capturyPoseCont = 58,
capturyActor2 = 59, capturyActorContinued2 = 60,
capturyLatency = 61,
capturyActors2 = 62, capturyActor3 = 63, capturyActorContinued3 = 64,
capturyError = 0 } CapturyPacketTypes;
// returns a string for nicer error messages
const char* Captury_getHumanReadableMessageType(CapturyPacketTypes type);
// make sure structures are laid out without padding
#pragma pack(push, 1)
// sent to server
struct CapturyRequestPacket {
int32_t type; // from capturyActors, capturyCameras, capturyDaySessionShot, capturySetShot, capturyStartRecording, capturyStopRecording
int32_t size; // size of full message including type and size
};
// sent to client
// as a reply to CapturyRequestPacket = capturyActors
struct CapturyActorsPacket {
int32_t type; // capturyActors
int32_t size; // size of full message including type and size
int32_t numActors;
};
// sent to client
// part of CapturyActorPacket
struct CapturyJointPacket {
char name[24];
int32_t parent;
float offset[3];
float orientation[3];
};
// sent to client
// part of CapturyActorPacket
struct CapturyJointPacket2 {
int32_t parent;
float offset[3];
float orientation[3];
char name[]; // zero terminated joint name
};
// sent to client
// part of CapturyActorPacket
struct CapturyJointPacket3 {
int32_t parent;
float offset[3];
float orientation[3];
float scale[3];
char name[]; // zero terminated joint name
};
// sent to client
// as a reply to CapturyRequestPacket = capturyActors
struct CapturyActorPacket {
int32_t type; // capturyActor or capturyActor2 or capturyActor3
int32_t size; // size of full message including type and size
char name[32];
int32_t id;
int32_t numJoints;
CapturyJointPacket joints[];
};
// sent to client
// as a reply to CapturyRequestPacket = capturyActors
// if the CapturyActorPacket becomes too big send this one
struct CapturyActorContinuedPacket {
int32_t type; // capturyActorContinued
int32_t size; // size of full message including type and size
int32_t id; // actor id
int32_t startJoint;
CapturyJointPacket joints[];
};
// sent to client
// as a reply to CapturyRequestPacket = capturyCameras
struct CapturyCamerasPacket {
int32_t type; // capturyCameras
int32_t size; // size of full message including type and size
int32_t numCameras;
};
// sent to client
// as a reply to CapturyRequestPacket = capturyCamera
struct CapturyCameraPacket {
int32_t type; // capturyCamera
int32_t size; // size of full message including type and size
char name[32];
int32_t id;
float position[3];
float orientation[3];
float sensorSize[2]; // in mm
float focalLength; // in mm
float lensCenter[2]; // in mm
};
// sent to server - old version needs to stay around for old clients
struct CapturyStreamPacket0 {
int32_t type; // capturyStream
int32_t size; // size of full message including type and size
int32_t what; // CAPTURY_STREAM_POSES or CAPTURY_STREAM_NOTHING
};
// sent to server
struct CapturyStreamPacket {
int32_t type; // capturyStream
int32_t size; // size of full message including type and size
int32_t what; // CAPTURY_STREAM_POSES or CAPTURY_STREAM_NOTHING
int32_t cameraId; // valid if what & CAPTURY_STREAM_IMAGES
};
// sent to client
// as a reply to CapturyRequestPacket = capturyDaySessionShot
struct CapturyDaySessionShotPacket {
int32_t type; // capturyDaySessionShot
int32_t size; // size of full message including type and size
char day[100];
char session[100];
char shot[100];
};
// sent to server
struct CapturySetShotPacket {
int32_t type; // capturySetShot
int32_t size; // size of full message including type and size
char shot[100];
};
// sent to client
// as a reply to CapturyStreamPacket
struct CapturyPosePacket {
int32_t type; // capturyPose
int32_t size; // size of full message including type and size
int32_t actor;
uint64_t timestamp;
int32_t numValues; // multiple of 6
float values[];
};
// sent to client
// as a reply to CapturyStreamPacket
struct CapturyPosePacket2 {
int32_t type; // capturyPose2
int32_t size; // size of full message including type and size
int32_t actor;
uint64_t timestamp;
uint8_t trackingQuality; // [0 .. 100]
uint8_t scalingProgress; // [0 .. 100]
uint8_t flags; // CAPTURY_LEFT_FOOT_ON_GROUND | CAPTURY_RIGHT_FOOT_ON_GROUND
uint8_t reserved; // 0 for now
int32_t numValues; // multiple of 6
float values[];
};
struct CapturyPoseCont {
int32_t type; // capturyPoseCont
int32_t size; // size of full message including type and size
int32_t actor;
uint64_t timestamp;
float values[];
};
// sent to server
struct CapturyConstraintPacket {
int32_t type; // capturyConstraint
int32_t size;
int32_t constrType;
int32_t originActor;
int32_t originJoint;
float originOffset[3];
int32_t targetActor;
int32_t targetJoint;
float targetOffset[3];
float targetVector[3];
float targetValue;
float targetRotation[4];
float weight;
};
// sent to client
// as a reply to capturyGetTime
struct CapturyTimePacket {
int32_t type; // capturyTime
int32_t size;
uint64_t timestamp;
};
// sent to server
struct CapturyGetMarkerTransformPacket {
int32_t type; // capturyGetMarkerTransform
int32_t size;
int32_t actor;
int32_t joint;
};
// sent to client
// as a reply to capturyGetMarkerTransform
struct CapturyMarkerTransformPacket {
int32_t type; // capturyMarkerTransform
int32_t size;
uint64_t timestamp;
int32_t actor;
int32_t joint;
float rotation[3]; // XYZ Euler angles
float translation[3];
};
// sent to server
struct CapturyGetScalingProgressPacket {
int32_t type; // capturyGetScalingProgress
int32_t size;
int32_t actor;
};
// sent to client
// as a reply to capturyGetScalingProgress
struct CapturyScalingProgressPacket {
int32_t type; // capturyScalingProgress
int32_t size;
int32_t actor;
int8_t progress; // value from 0 to 100
};
// sent in both directions
// a CapturyRequestPacket = capturyCustomAck is always sent in reply
struct CapturyCustomPacket {
int32_t type; // capturyCustom
int32_t size;
char name[16];
char data[];
};
// sent to server
struct CapturyGetImagePacket {
int32_t type; // capturyGetImage
int32_t size;
int32_t actor;
};
struct CapturyGetImageDataPacket {
int32_t type; // capturyGetImageData
int32_t size;
uint16_t port;
int32_t actor;
};
// sent to client
// as a reply to capturyGetImage or for streamed cameras
//
struct CapturyImageHeaderPacket {
int32_t type; // capturyImageHeader, capturyStreamedImageHeader
int32_t size;
int32_t actor; // for capturyStreamedImageHeader this is the camera id
uint64_t timestamp;
uint32_t fourcc; // image compression format
int32_t width;
int32_t height;
int32_t dataPacketSize; // size of data packets
int32_t dataSize;
};
struct CapturyImageDataPacket {
int32_t type; // capturyImageData, capturyStreamedImageData
int32_t size;
int32_t actor; // for capturyStreamedImageData this is the camera id
int32_t offset; // offset in bytes into the following data (0 for first packet)
unsigned char data[]; // width*height*3 bytes
};
struct CapturySnapActorPacket {
int32_t type; // capturySnapActor
int32_t size;
float x;
float z;
float heading;
};
struct CapturySnapActorPacket2 {
int32_t type; // capturySnapActor
int32_t size;
float x;
float z;
float radius;
float heading;
uint8_t snapMethod;
uint8_t quickScaling;
char skeletonName[32];
};
struct CapturyStartTrackingPacket {
int32_t type; // capturyStartTracking
int32_t size;
int32_t actor;
float x;
float z;
float heading;
};
struct CapturyStopTrackingPacket {
int32_t type; // capturyStopTracking or capturyDeleteActor or capturyRescaleActor or capturyRecolorActor
int32_t size;
int32_t actor;
};
struct CapturyActorModeChangedPacket {
int32_t type; // capturyActorModeChanged
int32_t size;
int32_t actor;
int32_t mode;
};
struct CapturyARTagPacket {
int32_t type; // capturyARTag
int32_t size;
int32_t numTags;
CapturyARTag tags[1];
};
struct CapturyBackgroundQualityPacket {
int32_t type; // capturyBackgroundQuality
int32_t size;
int32_t quality;
};
struct CapturySetActorNamePacket {
int32_t type; // capturySetActorName
int32_t size;
int32_t actor;
char name[32];
};
struct CapturyStatusPacket {
int32_t type; // capturyStatus
int32_t size;
char message[1]; // 0-terminated
};
// sent to client
// as a reply to CapturyStreamPacket
struct CapturyIMUData {
int32_t type; // capturyIMU
int32_t size; // size of full message including type and size
uint8_t numIMUs;
float eulerAngles[]; // 3x numIMUs floats
};
// sent to client
// as a reply to CapturyStreamPacket
struct CapturyLatencyPacket {
int32_t type; // capturyLatency
int32_t size; // size of full message including type and size
uint64_t firstImagePacket;
uint64_t optimizationStart;
uint64_t optimizationEnd;
uint64_t sendPacketTime; // right before packet is sent
uint64_t poseTimestamp; // timestamp of corresponding pose
};
#pragma pack(pop)
#ifndef FOURCC
#define FOURCC(a,b,c,d) (((d)<<24)|((c)<<16)|((b)<<8)|(a))
#endif
#define FOURCC_RGB FOURCC('2','4',' ',' ') // uncompressed RGB
#ifdef __cplusplus
} // extern "C"
#endif