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

            try
            {
                dets = NativeMethods.vector_Rect_new1();
                NativeMethods.dlib_dnn_mmod_face_detection_operator(detector, inputImage.DlibMatrixRgbPixel, 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 MatrixRgbPixel(MatrixRgbPixel copyingSource)
 {
     Trace.Assert(copyingSource != null);
     Trace.Assert(copyingSource.DlibMatrixRgbPixel != IntPtr.Zero);
     DlibMatrixRgbPixel = NativeMethods.dlib_matrix_rgbpixel_new_copied(copyingSource.DlibMatrixRgbPixel);
 }
コード例 #4
0
 public void SetImage(MatrixRgbPixel image)
 {
     NativeMethods.dlib_image_window_set_image_matrix_rgbpixel(DlibImageWindow, image.DlibMatrixRgbPixel);
 }