Example #1
0
        public ImagePixelsContainer(Bitmap bitmap)
        {
            var bytesPerPixel = 4;
            var width         = bitmap.Width;
            var height        = bitmap.Height;
            var stride        = bitmap.Width * bytesPerPixel;
            var size          = stride * height;

            // camera image
            var pixels = new int[size / sizeof(int)];

            bitmap.GetPixels(pixels, 0, stride / sizeof(int), 0, 0, width, height);

            // copy to unmanaged memory
            UnmanagedPtr = Marshal.AllocCoTaskMem(size);
            Marshal.Copy(pixels, 0, UnmanagedPtr, pixels.Length);

            Payload = new ImagePixels(width, height, bytesPerPixel, stride, UnmanagedPtr);
        }
 public static extern int DrawFaceFrames(ref ImagePixels pixels,
                                         [MarshalAs(UnmanagedType.LPUTF8Str), In] string path);
 public static extern void ToNegaPosiLibTest(ref ImagePixels pixels);
 public static extern void ToNegaPosiOpenCv(ref ImagePixels pixels);
 public static extern double GetAverageG(ref ImagePixels pixels);