public override Detection GetValue()
        {
            var detectionPtr = UnsafeNativeMethods.MpPacketGetDetection(ptr);
            var detection    = SerializedProto.FromPtr <Detection>(detectionPtr, Detection.Parser);

            UnsafeNativeMethods.MpSerializedProtoDestroy(detectionPtr);

            return(detection);
        }
        public override Rect GetValue()
        {
            var rectPtr = UnsafeNativeMethods.MpPacketGetRect(ptr);
            var rect    = SerializedProto.FromPtr <Rect>(rectPtr, Rect.Parser);

            UnsafeNativeMethods.MpSerializedProtoDestroy(rectPtr);

            return(rect);
        }
Ejemplo n.º 3
0
        public override NormalizedLandmarkList GetValue()
        {
            var landmarkListPtr = UnsafeNativeMethods.MpPacketGetNormalizedLandmarkList(ptr);
            var rect            = SerializedProto.FromPtr <NormalizedLandmarkList>(landmarkListPtr, NormalizedLandmarkList.Parser);

            UnsafeNativeMethods.MpSerializedProtoDestroy(landmarkListPtr);

            return(rect);
        }
        public override ClassificationList GetValue()
        {
            var classificationListPtr = UnsafeNativeMethods.MpPacketGetClassificationList(ptr);
            var rect = SerializedProto.FromPtr <ClassificationList>(classificationListPtr, ClassificationList.Parser);

            UnsafeNativeMethods.MpSerializedProtoDestroy(classificationListPtr);

            return(rect);
        }
Ejemplo n.º 5
0
        public static List <T> FromPtr <T>(IntPtr ptr, pb::MessageParser <T> parser) where T : pb::IMessage <T>
        {
            var inner  = Marshal.PtrToStructure <SerializedProtoVectorInner>(ptr);
            var protos = new List <T>(inner.size);

            unsafe {
                var arr = inner.data;

                for (var i = 0; i < inner.size; i++)
                {
                    protos.Add(SerializedProto.FromPtr <T>((IntPtr)(*arr++), parser));
                }
            }

            return(protos);
        }