コード例 #1
0
 public static void ResizeImageWithResizeImageInterporateKind(Array2dUchar src, Array2dUchar dest, ResizeImageInterporateKind kind)
 {
     Trace.Assert(src != null && dest != null);
     Trace.Assert(src.DlibArray2dUchar != IntPtr.Zero);
     Trace.Assert(dest.DlibArray2dUchar != IntPtr.Zero);
     NativeMethods.dlib_resize_image_array2d_uchar_src_dest_interporation_kind(src.DlibArray2dUchar, dest.DlibArray2dUchar, (int)kind);
 }
コード例 #2
0
        public System.Drawing.Rectangle[] DetectFaces(Array2dUchar array2dUchar, double threshold)
        {
            var ret = new System.Drawing.Rectangle[0];

            try
            {
                dets = NativeMethods.vector_Rect_new1();
                NativeMethods.dlib_frontal_face_detector_operator(detector, array2dUchar.DlibArray2dUchar, threshold, dets);
                unsafe
                {
                    Trace.Assert(dets != null && dets != IntPtr.Zero);
                    long count = NativeMethods.vector_Rect_getSize(dets).ToInt64();
                    // If it does not return ret here, exception occurs.
                    if (count == 0)
                    {
                        return(ret);
                    }
                    Rect *rectangles = (Rect *)NativeMethods.vector_Rect_getPointer(dets).ToPointer();
                    ret = new System.Drawing.Rectangle[count];
                    for (int i = 0; i < count; i++)
                    {
                        var src = rectangles[i];
                        ret[i] = new System.Drawing.Rectangle(src.X, src.Y, src.Width, src.Height);
                    }
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debugger.Break();
#endif
                Console.WriteLine(ex.Message);
            }
            finally
            {
                ReleaseDets();
            }
            return(ret);
        }
コード例 #3
0
 public Array2dUchar(Array2dUchar copyingSource)
 {
     Trace.Assert(copyingSource != null);
     Trace.Assert(copyingSource.DlibArray2dUchar != IntPtr.Zero);
     DlibArray2dUchar = NativeMethods.dlib_array2d_uchar_new_copied(copyingSource.DlibArray2dUchar);
 }
コード例 #4
0
 public void SetImage(Array2dUchar image)
 {
     NativeMethods.dlib_image_window_set_image_array2d_uchar(DlibImageWindow, image.DlibArray2dUchar);
 }