コード例 #1
0
 public static extern Dlib.Native.ErrorType hough_transform_operator(
     IntPtr obj,
     Dlib.Native.Array2DType in_type,
     IntPtr in_img,
     Dlib.Native.Array2DType out_type,
     IntPtr out_img,
     IntPtr rectangle);
コード例 #2
0
        private Array(bool specifySize, uint size)
        {
            if (!SupportItemTypes.TryGetValue(typeof(T), out this._ItemType))
            {
                throw new NotSupportedException($"{typeof(T).Name} does not support");
            }

            switch (this._ItemType)
            {
            case ItemTypes.PixelType:
            {
                if (!SupportArray2DElementTypes.TryGetValue(typeof(T), out this._ArrayElementType))
                {
                    throw new NotSupportedException($"{typeof(T).Name} does not support");
                }

                var type = this._ArrayElementType.ToNativeArray2DType();
                this.NativePtr = specifySize ? Dlib.Native.array_new1(type, size) : Dlib.Native.array_new(type);
            }
            break;

            case ItemTypes.Array2D:
            {
                var types = typeof(T).GenericTypeArguments;
                if (types.Length != 1)
                {
                    throw new NotSupportedException($"{typeof(T).Name} does not support");
                }
                if (!SupportArray2DElementTypes.TryGetValue(types[0], out this._ArrayElementType))
                {
                    throw new NotSupportedException($"{types[0].Name} does not support");
                }

                var type = this._ArrayElementType.ToNativeArray2DType();
                this.NativePtr    = specifySize ? Dlib.Native.array_array2d_new1(type, size) : Dlib.Native.array_array2d_new(type);
                this._Array2DType = this._ArrayElementType.ToNativeArray2DType();
            }
            break;

            case ItemTypes.Matrix:
            {
                var types = typeof(T).GenericTypeArguments;
                if (types.Length != 1)
                {
                    throw new NotSupportedException($"{typeof(T).Name} does not support");
                }
                if (!SupportMatrixElementTypes.TryGetValue(types[0], out this._MatrixElementType))
                {
                    throw new NotSupportedException($"{typeof(T).Name} does not support");
                }

                var type = this._MatrixElementType.ToNativeMatrixElementType();
                this.NativePtr = specifySize ? Dlib.Native.array_matrix_new1(type, size) : Dlib.Native.array_matrix_new(type);
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #3
0
 public static extern Dlib.Native.ErrorType face_recognition_face_encodings2(
     IntPtr output,
     IntPtr recognitor,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     IntPtr landmarks,
     double padding = 0.2d);
コード例 #4
0
 public static extern Dlib.Native.ErrorType face_recognition_face_landmarks(
     IntPtr output,
     IntPtr recognitor,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     IntPtr rectangles
     );
コード例 #5
0
 public static extern Dlib.Native.ErrorType face_recognition_face_locations(
     IntPtr output,
     IntPtr recognitor,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     uint number_of_times_to_upsample,
     byte[] model);
コード例 #6
0
ファイル: MatrixOp.cs プロジェクト: pitt123/DlibDotNet
 internal MatrixOp(Dlib.Native.ElementType elementType, ImageTypes type, IntPtr ptr)
 {
     this._ElementType = elementType;
     this._Array2DType = type.ToNativeArray2DType();
     this.NativePtr    = ptr;
     this._ImageType   = type;
 }
コード例 #7
0
        internal MatrixOp(Dlib.Native.ElementType elementType, ImageTypes type, IntPtr ptr, int templateRows = 0, int temlateColumns = 0)
        {
            this._ElementType = elementType;
            this._Array2DType = type.ToNativeArray2DType();
            this.NativePtr    = ptr;
            this._ImageType   = type;

            this.TemplateRows    = templateRows;
            this.TemplateColumns = temlateColumns;
        }
コード例 #8
0
        internal Array2D(IntPtr ptr, ImageTypes type)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr));
            }

            this.NativePtr    = ptr;
            this._Array2DType = type.ToNativeArray2DType();

            this.ImageType = type;
        }
コード例 #9
0
        private object GetPixelItem(Dlib.Native.Array2DType type, uint index)
        {
            switch (type)
            {
            case Dlib.Native.Array2DType.UInt8:
                Dlib.Native.array_pixel_getitem_uint8(type, this.NativePtr, index, out var b8);
                return(b8);

            case Dlib.Native.Array2DType.UInt16:
                Dlib.Native.array_pixel_getitem_uint16(type, this.NativePtr, index, out var b16);
                return(b16);

            case Dlib.Native.Array2DType.UInt32:
                Dlib.Native.array_pixel_getitem_uint32(type, this.NativePtr, index, out var b32);
                return(b32);

            case Dlib.Native.Array2DType.Int8:
                Dlib.Native.array_pixel_getitem_int8(type, this.NativePtr, index, out var u8);
                return(u8);

            case Dlib.Native.Array2DType.Int16:
                Dlib.Native.array_pixel_getitem_int16(type, this.NativePtr, index, out var u16);
                return(u16);

            case Dlib.Native.Array2DType.Int32:
                Dlib.Native.array_pixel_getitem_int32(type, this.NativePtr, index, out var u32);
                return(u32);

            case Dlib.Native.Array2DType.Float:
                Dlib.Native.array_pixel_getitem_float(type, this.NativePtr, index, out var f);
                return(f);

            case Dlib.Native.Array2DType.Double:
                Dlib.Native.array_pixel_getitem_double(type, this.NativePtr, index, out var d);
                return(d);

            case Dlib.Native.Array2DType.RgbPixel:
                Dlib.Native.array_pixel_getitem_rgb_pixel(type, this.NativePtr, index, out var rgb);
                return(rgb);

            case Dlib.Native.Array2DType.RgbAlphaPixel:
                Dlib.Native.array_pixel_getitem_rgb_alpha_pixel(type, this.NativePtr, index, out var rgba);
                return(rgba);

            case Dlib.Native.Array2DType.HsiPixel:
                Dlib.Native.array_pixel_getitem_hsi_pixel(type, this.NativePtr, index, out var hsi);
                return(hsi);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
コード例 #10
0
        public Array2D(int rows, int columns)
        {
            if (!SupportTypes.TryGetValue(typeof(TElement), out var type))
            {
                throw new NotSupportedException($"{typeof(TElement).Name} does not support");
            }

            this._Array2DType = type.ToNativeArray2DType();

            this.NativePtr = Dlib.Native.array2d_new1(this._Array2DType, rows, columns);
            if (this.NativePtr == IntPtr.Zero)
            {
                throw new ArgumentException($"{type} is not supported.");
            }

            this.ImageType = type;
        }
コード例 #11
0
        private object GetArray2DItem(Dlib.Native.Array2DType type, uint index)
        {
            var err = Dlib.Native.array_array2d_getitem(type,
                                                        this.NativePtr, index,
                                                        out var array);

            switch (type)
            {
            case Dlib.Native.Array2DType.UInt8:
                return(new Array2D <byte>(array, ImageTypes.UInt8, false));

            case Dlib.Native.Array2DType.UInt16:
                return(new Array2D <ushort>(array, ImageTypes.UInt16, false));

            case Dlib.Native.Array2DType.UInt32:
                return(new Array2D <uint>(array, ImageTypes.UInt32, false));

            case Dlib.Native.Array2DType.Int8:
                return(new Array2D <sbyte>(array, ImageTypes.Int8, false));

            case Dlib.Native.Array2DType.Int16:
                return(new Array2D <short>(array, ImageTypes.Int16, false));

            case Dlib.Native.Array2DType.Int32:
                return(new Array2D <int>(array, ImageTypes.Int32, false));

            case Dlib.Native.Array2DType.Float:
                return(new Array2D <float>(array, ImageTypes.Float, false));

            case Dlib.Native.Array2DType.Double:
                return(new Array2D <double>(array, ImageTypes.Double, false));

            case Dlib.Native.Array2DType.RgbPixel:
                return(new Array2D <RgbPixel>(array, ImageTypes.RgbPixel, false));

            case Dlib.Native.Array2DType.RgbAlphaPixel:
                return(new Array2D <RgbAlphaPixel>(array, ImageTypes.RgbAlphaPixel, false));

            case Dlib.Native.Array2DType.HsiPixel:
                return(new Array2D <HsiPixel>(array, ImageTypes.HsiPixel, false));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
コード例 #12
0
 public static extern Dlib.Native.ErrorType image_window_set_image_matrix_op(IntPtr window, Dlib.Native.ElementType matrixElementType, Dlib.Native.Array2DType type, IntPtr matrix);
コード例 #13
0
 public static extern Dlib.Native.ErrorType image_window_set_image_array2d(IntPtr window, Dlib.Native.Array2DType type, IntPtr image);
コード例 #14
0
 public static extern Dlib.Native.ErrorType image_window_add_overlay3(IntPtr window, IntPtr rect, Dlib.Native.Array2DType type, ref HsiPixel color);
コード例 #15
0
 public static extern Dlib.Native.ErrorType image_window_add_overlay2(IntPtr window, IntPtr vectorOfRect, Dlib.Native.Array2DType type, ref RgbAlphaPixel color);
コード例 #16
0
 public static extern IntPtr image_window_new_matrix_op2(Dlib.Native.ElementType matrixElementType, Dlib.Native.Array2DType type, IntPtr image, byte[] title);
コード例 #17
0
 public static extern IntPtr image_window_new_array2d2(Dlib.Native.Array2DType type, IntPtr image, byte[] title);
コード例 #18
0
 public static extern Dlib.Native.ErrorType matrix_op_op_jet_nr(Dlib.Native.Array2DType type, IntPtr obj, out int ret);
コード例 #19
0
 public static extern Dlib.Native.ErrorType perspective_window_add_overlay3(IntPtr window, IntPtr vector, Dlib.Native.Array2DType type, ref HsiPixel color);
コード例 #20
0
 public static extern void matrix_op_op_jet_delete(Dlib.Native.Array2DType type, IntPtr obj);
コード例 #21
0
 public static extern Dlib.Native.ErrorType correlation_tracker_start_track(
     IntPtr tracker,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     IntPtr p);
コード例 #22
0
 public static extern Dlib.Native.ErrorType matrix_op_op_heatmap_operator(Dlib.Native.Array2DType type, IntPtr matrix, int r, int c, IntPtr rgbPixel);
コード例 #23
0
 private void PushBackArray2DItem(Dlib.Native.Array2DType type, IDlibObject item)
 {
     item.ThrowIfDisposed();
     Dlib.Native.array_array2d_pushback(type, this.NativePtr, item.NativePtr);
 }
コード例 #24
0
 public static extern IntPtr image_window_new_array2d1(Dlib.Native.Array2DType type, IntPtr image);
コード例 #25
0
 public static extern Dlib.Native.ErrorType correlation_tracker_update2(
     IntPtr tracker,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     out double confident);
コード例 #26
0
 public static extern Dlib.Native.ErrorType matrix_op_op_array2d_to_mat_nc(Dlib.Native.Array2DType type, IntPtr obj, out int ret);
コード例 #27
0
 public static extern Dlib.Native.ErrorType shape_predictor_operator(
     IntPtr detector,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     IntPtr rect,
     out IntPtr fullObjDetect);
コード例 #28
0
ファイル: OverlayDot.cs プロジェクト: pitt123/DlibDotNet
 public static extern IntPtr perspective_window_overlay_dot_new2(IntPtr v, Dlib.Native.Array2DType type, ref HsiPixel color);
コード例 #29
0
 public static extern Dlib.Native.ErrorType frontal_face_detector_operator(
     IntPtr detector,
     Dlib.Native.Array2DType imgType,
     IntPtr img,
     double adjustThreshold,
     IntPtr dets);
コード例 #30
0
 public static extern Dlib.Native.ErrorType perspective_window_add_overlay(IntPtr window, IntPtr p1, IntPtr p2, Dlib.Native.Array2DType type, ref RgbAlphaPixel color);