Пример #1
0
        private static VideoFrame InternalCreateFrame(int width, int height, VideoCameraFrame cameraFrame)
        {
            var rv = new VideoFrame();

            if (cameraFrame.ImageLayout == VideoFrameLayout.Monochrome)
            {
                rv.pixels = new int[height, width];

                rv.pixels = (int[, ])cameraFrame.Pixels;
            }
            else if (cameraFrame.ImageLayout == VideoFrameLayout.Color)
            {
                rv.pixels = new int[height, width, 3];

                rv.pixels = (int[, , ])cameraFrame.Pixels;
            }
            else if (cameraFrame.ImageLayout == VideoFrameLayout.BayerRGGB)
            {
                throw new NotSupportedException();
            }
            else
            {
                throw new NotSupportedException();
            }

            rv.previewBitmapBytes = cameraFrame.PreviewBitmapBytes;
            rv.frameNumber        = cameraFrame.FrameNumber;
            rv.exposureStartTime  = null;
            rv.exposureDuration   = null;
            rv.imageInfo          = null;

            return(rv);
        }
        private static VideoFrame InternalCreateFrame(int width, int height, VideoCameraFrame cameraFrame, bool variant)
        {
            var rv = new VideoFrame();

            if (variant)
            {
                rv.pixelsVariant = new object[height, width];
                rv.pixels        = null;
            }
            else
            {
                rv.pixels        = new int[height, width];
                rv.pixelsVariant = null;
            }

            rv.previewBitmapBytes = cameraFrame.PreviewBitmapBytes;

            if (variant)
            {
                Array.Copy(cameraFrame.Pixels, rv.pixelsVariant, cameraFrame.Pixels.Length);
            }
            else
            {
                rv.pixels = cameraFrame.Pixels;
            }

            rv.frameNumber       = cameraFrame.FrameNumber;
            rv.exposureStartTime = cameraFrame.ExposureStartTime != null
                                ? cameraFrame.ExposureStartTime.Value.ToString("yyyy-MM-ddTHH:mm:ss.fff")
                                : null;

            rv.exposureDuration = cameraFrame.ExposureDuration;
            rv.imageInfo        = cameraFrame.ImageInfo;

            return(rv);
        }
Пример #3
0
 internal static VideoFrame CreateFrame(int width, int height, VideoCameraFrame cameraFrame)
 {
     return(InternalCreateFrame(width, height, cameraFrame));
 }