internal static VideoFrame CreateFrame(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.frameNumber = cameraFrame.FrameNumber; rv.exposureStartTime = null; rv.exposureDuration = null; rv.imageInfo = null; return rv; }
public bool GetCurrentFrame(out VideoCameraFrame cameraFrame) { long frameId; Bitmap bmp = dsCapture.GetNextFrame(out frameId); if (bmp != null) { using (bmp) { object pixels = cameraImageHelper.GetImageArray(bmp, SimulatedSensorType, (LumaConversionMode)DriverSettings.Instance.MonochromePixelsType); cameraFrame = new VideoCameraFrame() { FrameNumber = frameId, Pixels = pixels, ImageLayout = DriverSettings.Instance.SimulatedImageLayout }; } return true; } cameraFrame = null; return false; }