Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var cameras = Cameras.DeclareDevice()
                          .Named("Camera 1").WithDevicePath("/dev/video0")
                          .Memorize();

            //cameras.Get("Camera 1").SavePicture(new PictureSize(640, 480), "Test1.jpg", 20);
            //cameras.Default.SavePicture(new PictureSize(640, 480), "Test2.jpg", 20);

            var videoServer = new TcpVideoServer(8080, cameras);

            Console.WriteLine("Server strating ...");
            videoServer.Start();
            Console.WriteLine("Server strated.");


            //var handle = RaspberryCamInterop.OpenCameraStream("/dev/video0", 640, 480, 20);
            //var pictureBuffer = RaspberryCamInterop.GrabVideoFrame(handle);
            //var data = new byte[pictureBuffer.Size];
            //Marshal.Copy(pictureBuffer.Data, data, 0, pictureBuffer.Size);
            //File.WriteAllBytes("grab.mjpeg", data);
            //RaspberryCamInterop.CloseCameraStream(handle);


            Console.WriteLine("Press any key to quit ...");
            Console.ReadKey(true);

            videoServer.Stop();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the cameras from the database.
        /// </summary>
        private void InitializeCameras()
        {
            availableCameras = new CameraQuery().GetAllCamera();
            camBuilder       = Cameras.DeclareDevice().Named(availableCameras[1].CameraName).WithDevicePath(availableCameras[1].Path)
                               .AndDevice().Named(availableCameras[0].CameraName).WithDevicePath(availableCameras[0].Path);

            cameras = camBuilder.Memorize();
        }
Exemplo n.º 3
0
        public RaspberryCamVideoStreamPhotoMaker()
        {
            var cameras = Cameras.DeclareDevice()
                          .Named("Camera 1")
                          .WithDevicePath("/dev/video0")
                          .Memorize();

            this.cameraDriver = cameras.Get("Camera 1");

            this.cameraDriver.StartVideoStreaming(this.pictureSize);
        }
        public async Task <string> MakePhoto()
        {
            var filePath = $"{Guid.NewGuid()}.jpg";
            var cameras  = Cameras.DeclareDevice()
                           .Named("Camera 1")
                           .WithDevicePath("/dev/video0")
                           .Memorize();

            var camera      = cameras.Get("Camera 1");
            var pictureSize = new PictureSize(1280, 720);

            camera.SavePicture(pictureSize, filePath, 0);

            return(filePath);
        }
 public CameraConnection(string key, string path, int port)
 {
     try
     {
         _key  = key;
         _path = path;
         _port = port;
         _cam  = Cameras.DeclareDevice().Named(key).WithDevicePath(path).Memorize();
         //_server = new TcpVideoServer (_port, _cam);
     }
     catch (Exception ex) {
         LogWriter.WriteLog(string.Format("An error occurred while attempting to initialize the camera {0}", key), ex);
         throw ex;
     }
 }