public static void ResizeImageWithResizeImageInterporateKind(Array2dRgbPixel src, Array2dRgbPixel dest, ResizeImageInterporateKind kind)
 {
     Trace.Assert(src != null && dest != null);
     Trace.Assert(src.DlibArray2dRgbPixel != IntPtr.Zero);
     Trace.Assert(dest.DlibArray2dRgbPixel != IntPtr.Zero);
     NativeMethods.dlib_resize_image_array2d_rgbpixel_src_dest_interporation_kind(src.DlibArray2dRgbPixel, dest.DlibArray2dRgbPixel, (int)kind);
 }
Пример #2
0
        public FaceLandmark[] DetectFaceLandmarks(Array2dRgbPixel array2dRgbPixel, double faceDetectionThreshold)
        {
            var ret = new FaceLandmark[0];

            try
            {
                dets = NativeMethods.vector_FaceLandmarkInternal_new1();
                NativeMethods.dlib_face_landmark_detection_operator(detector, array2dRgbPixel.DlibArray2dRgbPixel, faceDetectionThreshold, dets);
                Trace.Assert(dets != null && dets != IntPtr.Zero);
                long count = NativeMethods.vector_FaceLandmarkInternal_getSize(dets).ToInt64();
                // If it does not return ret here, exception occurs.
                if (count == 0)
                {
                    return(ret);
                }
                unsafe
                {
                    FaceLandmarkInternal *faceLandmarkInternals = (FaceLandmarkInternal *)NativeMethods.vector_FaceLandmarkInternal_getPointer(dets).ToPointer();
                    ret = new FaceLandmark[count];
                    for (int i = 0; i < count; i++)
                    {
                        ret[i] = new FaceLandmark(faceLandmarkInternals[i]);
                    }
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debugger.Break();
#endif
                Console.WriteLine(ex.Message);
            }
            finally
            {
                ReleaseDets();
            }
            return(ret);
        }
 public Array2dRgbPixel(Array2dRgbPixel copyingSource)
 {
     Trace.Assert(copyingSource != null);
     Trace.Assert(copyingSource.DlibArray2dRgbPixel != IntPtr.Zero);
     DlibArray2dRgbPixel = NativeMethods.dlib_array2d_rgbpixel_new_copied(copyingSource.DlibArray2dRgbPixel);
 }
Пример #4
0
 public void SetImage(Array2dRgbPixel image)
 {
     NativeMethods.dlib_image_window_set_image_array2d_rgbpixel(DlibImageWindow, image.DlibArray2dRgbPixel);
 }