///<summary> Create a capture using the specific camera</summary> ///<param name="camIndex"> The index of the camera to create capture from, starting from 0</param> private CapturePi(int camIndex, CaptureConfig config) { CaptureSource = CaptureModuleType.Camera; InitOpenCV(); InitCapture(camIndex, PiCameraConfig.FromConfig(config)); RequestedConfig = config; }
public static PiCameraConfig FromConfig(CaptureConfig config) { var s = new PiCameraConfig(); if (config == null) { s.Width = 0; s.Height = 0; s.Bitrate = 0; s.Framerate = 0; s.Monochrome = 0; } else { s.Width = config.Resolution.Width; s.Height = config.Resolution.Height; s.Bitrate = config.Bitrate; s.Framerate = config.Framerate; s.Monochrome = config.Monochrome ? 1 : 0; } return(s); }
public static PiCameraConfig FromConfig(CaptureConfig config) { var s = new PiCameraConfig(); if (config == null) { s.Width = 0; s.Height = 0; s.Bitrate = 0; s.Framerate = 0; s.Monochrome = 0; } else { s.Width = config.Resolution.Width; s.Height = config.Resolution.Height; s.Bitrate = config.Bitrate; s.Framerate = config.Framerate; s.Monochrome = config.Monochrome ? 1 : 0; } return s; }
private void InitCapture(int camIndex, PiCameraConfig config) { try { if (config.Width == 0) { _ptr = CvInvokeRaspiCamCV.cvCreateCameraCapture(camIndex); } else { Log.InfoFormat("Requesting capture config {0}", config); _ptr = CvInvokeRaspiCamCV.cvCreateCameraCapture2(camIndex, ref config); } } catch (DllNotFoundException e) { Log.Fatal("Are you running with the solution configuration matched to the right OS? or missing libraspicamcv.so?", e); throw; } if (_ptr == IntPtr.Zero) { throw new NullReferenceException($"Error: Unable to create capture from camera #{camIndex}"); } }
private void InitCapture(int camIndex, PiCameraConfig config) { try { if (config.Width == 0) { _ptr = CvInvokeRaspiCamCV.cvCreateCameraCapture(camIndex); } else { Log.InfoFormat("Requesting capture config {0}", config); _ptr = CvInvokeRaspiCamCV.cvCreateCameraCapture2(camIndex, ref config); } } catch (DllNotFoundException e) { Log.Fatal("Are you running with the solution configuration matched to the right OS? or missing libraspicamcv.so?", e); throw; } if (_ptr == IntPtr.Zero) { throw new NullReferenceException(String.Format("Error: Unable to create capture from camera {0}", camIndex)); } }
public static extern IntPtr cvCreateCameraCapture2(int index, ref PiCameraConfig config);