示例#1
0
 ///<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;
 }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#4
0
 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}");
     }
 }
示例#5
0
 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));
     }
 }
示例#6
0
 public static extern IntPtr cvCreateCameraCapture2(int index, ref PiCameraConfig config);
示例#7
0
 public static extern IntPtr cvCreateCameraCapture2(int index, ref PiCameraConfig config);