Esempio n. 1
0
        public double Update(Array2DBase image, DRectangle guess)
        {
            this.ThrowIfDisposed();

            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }
            if (guess == null)
            {
                throw new ArgumentNullException(nameof(guess));
            }

            image.ThrowIfDisposed();
            guess.ThrowIfDisposed();

            if (guess.IsEmpty)
            {
                throw new ArgumentException($"{nameof(guess)} must not be empty");
            }

            var inType = image.ImageType.ToNativeArray2DType();
            var ret    = Native.correlation_tracker_update(this.NativePtr, inType, image.NativePtr, guess.NativePtr, out var confident);

            switch (ret)
            {
            case Dlib.Native.ErrorType.InputArrayTypeNotSupport:
                throw new ArgumentException($"Input {inType} is not supported.");
            }

            return(confident);
        }
Esempio n. 2
0
        public void StartTrack(Array2DBase image, DRectangle rect)
        {
            this.ThrowIfDisposed();

            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }
            if (rect == null)
            {
                throw new ArgumentNullException(nameof(rect));
            }

            image.ThrowIfDisposed();
            rect.ThrowIfDisposed();

            if (rect.IsEmpty)
            {
                throw new ArgumentException($"{nameof(rect)} must not be empty");
            }

            var inType = image.ImageType.ToNativeArray2DType();
            var ret    = Native.correlation_tracker_start_track(this.NativePtr, inType, image.NativePtr, rect.NativePtr);

            switch (ret)
            {
            case Dlib.Native.ErrorType.InputArrayTypeNotSupport:
                throw new ArgumentException($"Input {inType} is not supported.");
            }
        }
Esempio n. 3
0
        public DRectangle(DRectangle drect)
        {
            if (drect == null)
            {
                throw new ArgumentNullException(nameof(drect));
            }

            drect.ThrowIfDisposed();

            this.NativePtr = Native.drectangle_new4(drect.NativePtr);
        }
Esempio n. 4
0
        public DRectangle Operator(DRectangle drectangle)
        {
            if (drectangle == null)
            {
                throw new ArgumentNullException(nameof(drectangle));
            }

            drectangle.ThrowIfDisposed();

            var ptr = Native.rectangle_transform_operator_d(this.NativePtr, drectangle.NativePtr);

            return(new DRectangle(ptr));
        }
Esempio n. 5
0
        public void AddOverlay(DRectangle rect, HsiPixel color)
        {
            this.ThrowIfDisposed();

            if (rect == null)
            {
                throw new ArgumentNullException(nameof(rect));
            }

            rect.ThrowIfDisposed();

            Native.image_window_add_overlay3(this.NativePtr, rect.NativePtr, Dlib.Native.Array2DType.HsiPixel, ref color);
        }
Esempio n. 6
0
        public DRectangle Intersect(DRectangle drect)
        {
            if (drect == null)
            {
                throw new ArgumentNullException(nameof(drect));
            }

            drect.ThrowIfDisposed();

            var result = Native.drectangle_intersect(this.NativePtr, drect.NativePtr);

            return(new DRectangle(result));
        }
Esempio n. 7
0
        public static DRectangle CenteredRect(DRectangle drect, double width, double height)
        {
            if (drect == null)
            {
                throw new ArgumentNullException(nameof(drect));
            }

            drect.ThrowIfDisposed();

            var result = Native.drectangle_centered_rect(drect.NativePtr, width, height);

            return(new DRectangle(result));
        }
Esempio n. 8
0
        public static DRectangle Translate(DRectangle drect, DPoint point)
        {
            if (drect == null)
            {
                throw new ArgumentNullException(nameof(drect));
            }
            if (point == null)
            {
                throw new ArgumentNullException(nameof(point));
            }

            drect.ThrowIfDisposed();
            point.ThrowIfDisposed();

            var result = Native.drectangle_translate_rect_d(drect.NativePtr, point.NativePtr);

            return(new DRectangle(result));
        }