Example #1
0
        public void AddOverlay(DRectangle rect, RgbAlphaPixel color)
        {
            this.ThrowIfDisposed();

            using (var native = rect.ToNative())
                Native.image_window_add_overlay3(this.NativePtr, native.NativePtr, Dlib.Native.Array2DType.RgbAlphaPixel, ref color);
        }
Example #2
0
        /// <summary>
        /// Adds the given overlay rectangle into this object such that it will be displayed.
        /// </summary>
        /// <param name="rect">A <see cref="DRectangle"/> structure that represents the rectangle to be displayed.</param>
        /// <param name="color">A <see cref="HsiPixel"/> value that represents a color.</param>
        /// <exception cref="ObjectDisposedException"><see cref="ImageWindow"/> is disposed.</exception>
        public void AddOverlay(DRectangle rect, HsiPixel color)
        {
            this.ThrowIfDisposed();

            using (var native = rect.ToNative())
                NativeMethods.image_window_add_overlay3(this.NativePtr, native.NativePtr, NativeMethods.Array2DType.HsiPixel, ref color);
        }
Example #3
0
        public double Update(Array2DBase image, DRectangle guess)
        {
            this.ThrowIfDisposed();

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

            image.ThrowIfDisposed();

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

            var inType = image.ImageType.ToNativeArray2DType();

            using (var native = guess.ToNative())
            {
                var ret = Native.correlation_tracker_update(this.NativePtr, inType, image.NativePtr, native.NativePtr, out var confident);
                switch (ret)
                {
                case Dlib.Native.ErrorType.InputArrayTypeNotSupport:
                    throw new ArgumentException($"Input {inType} is not supported.");
                }

                return(confident);
            }
        }
Example #4
0
        public void StartTrack(Array2DBase image, DRectangle rect)
        {
            this.ThrowIfDisposed();

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

            image.ThrowIfDisposed();

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

            var inType = image.ImageType.ToNativeArray2DType();

            using (var native = rect.ToNative())
            {
                var ret = Native.correlation_tracker_start_track(this.NativePtr, inType, image.NativePtr, native.NativePtr);
                switch (ret)
                {
                case Dlib.Native.ErrorType.InputArrayTypeNotSupport:
                    throw new ArgumentException($"Input {inType} is not supported.");
                }
            }
        }
Example #5
0
 public DRectangle Operator(DRectangle drectangle)
 {
     using (var native = drectangle.ToNative())
     {
         var ptr = NativeMethods.rectangle_transform_operator_d(this.NativePtr, native.NativePtr);
         return(new DRectangle(ptr));
     }
 }
Example #6
0
        public ChipDetails(DRectangle rect, ChipDims dims)
        {
            if (dims == null)
            {
                throw new ArgumentNullException(nameof(dims));
            }

            dims.ThrowIfDisposed();

            using (var tmp = rect.ToNative())
                this.NativePtr = Native.chip_details_new2(tmp.NativePtr, dims.NativePtr);
        }
Example #7
0
        public override DRectangle RectDown(DRectangle rect)
        {
            using (var p = rect.ToNative())
            {
                var err = NativeMethods.pyramid_down_rect_down(this.NativePtr,
                                                               this.PyramidRate,
                                                               p.NativePtr,
                                                               out var ret);

                switch (err)
                {
                case NativeMethods.ErrorType.PyramidNotSupportRate:
                    throw new NotSupportedException();
                }

                return(new DRectangle(ret));
            }
        }
Example #8
0
        public override DRectangle RectUp(DRectangle rect, uint levels)
        {
            using (var p = rect.ToNative())
            {
                var err = Native.pyramid_down_rect_up2(this.NativePtr,
                                                       this.PyramidRate,
                                                       p.NativePtr,
                                                       levels,
                                                       out var ret);

                switch (err)
                {
                case Dlib.Native.ErrorType.PyramidNotSupportRate:
                    throw new NotSupportedException();
                }

                return(new DRectangle(ret));
            }
        }
Example #9
0
 public ChipDetails(DRectangle rect, uint size, double angle)
 {
     using (var tmp = rect.ToNative())
         this.NativePtr = Native.chip_details_new5(tmp.NativePtr, size, angle);
 }
Example #10
0
 public ChipDetails(DRectangle rect, uint size)
 {
     using (var tmp = rect.ToNative())
         this.NativePtr = NativeMethods.chip_details_new4(tmp.NativePtr, size);
 }