Exemplo n.º 1
0
        public static ChipDetails[] GetFaceChipDetails(IEnumerable <FullObjectDetection> dets, uint size = 200, double padding = 0.2d)
        {
            if (dets == null)
            {
                throw new ArgumentNullException(nameof(dets));
            }
            if (size <= 0)
            {
                throw new ArgumentException();
            }
            if (padding < 0)
            {
                throw new ArgumentException();
            }
            if (dets.Any(detection => detection == null || detection.IsDisposed || detection.Parts != 68))
            {
                throw new ArgumentException($"{nameof(dets)} includes invalid item.");
            }

            using (var vector = new VectorOfFullObjectDetection(dets))
                using (var vectorOfChips = new VectorOfChipDetails())
                {
                    Native.get_face_chip_details(vector.NativePtr, size, padding, vectorOfChips.NativePtr);
                    return(vectorOfChips.ToArray());
                }
        }
Exemplo n.º 2
0
        public static ImageWindow.OverlayLine[] RenderFaceDetections(IEnumerable <FullObjectDetection> detection, RgbPixel color)
        {
            if (detection == null)
            {
                throw new ArgumentNullException(nameof(detection));
            }

            using (var vectorIn = new VectorOfFullObjectDetection(detection))
                using (var vectorOut = new VectorOfImageWindowOverlayLine())
                {
                    Native.render_face_detections(vectorIn.NativePtr, ref color, vectorOut.NativePtr);
                    return(vectorOut.ToArray());
                }
        }