Esempio n. 1
0
 // Close the camera.
 static void CameraClose(ref tCamera Camera)
 {
     // Reset the trigger mode.
     Pv.AttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun");
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
 }
Esempio n. 2
0
        // Setup the camera for capture.
        static bool CameraSetup(ref tCamera Camera)
        {
            UInt32 FrameSize = 0;

            if (Pv.CameraOpen(Camera.UID, tAccessFlags.eAccessMaster, out Camera.Handle) == 0)
            {
                // Get the bytes size of the buffer.
                if (Pv.AttrUint32Get(Camera.Handle, "TotalBytesPerFrame", ref FrameSize) == 0)
                {
                    Camera.Buffer = new byte[FrameSize];
                    Camera.GC     = GCHandle.Alloc(Camera.Buffer, GCHandleType.Pinned);
                    // Address of the pinned buffer.
                    Camera.Frame.ImageBuffer = Camera.GC.AddrOfPinnedObject();
                    // Buffer size.
                    Camera.Frame.ImageBufferSize = FrameSize;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                Pv.CameraClose(Camera.Handle);
                Camera.Handle = 0;
                return(false);
            }
        }
Esempio n. 3
0
 // Unsetup the camera.
 static void CameraUnsetup(ref tCamera Camera)
 {
     Console.WriteLine("Closing the camera now...");
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
     Console.WriteLine("Closed.");
     // Reset the handle.
     Camera.Handle = 0;
 }
Esempio n. 4
0
 // Close the camera.
 static void CameraClose()
 {
     // Clear the queue.
     Console.WriteLine("Clearing the queue...");
     Pv.CaptureQueueClear(GCamera.Handle);
     // close the camera
     Console.WriteLine("The camera is now closed.");
     Pv.CameraClose(GCamera.Handle);
 }
Esempio n. 5
0
        // Close the camera.
        static void CameraClose()
        {
            // Reset the trigger mode.
            Pv.AttrEnumSet(GCamera.Handle, "FrameStartTriggerMode", "Freerun");
            // Close the camera.
            Pv.CameraClose(GCamera.Handle);
            // Reset the handle.
            GCamera.Handle = 0;

            Console.WriteLine("The Camera is now closed.");
        }
Esempio n. 6
0
 // Close the camera.
 static void CameraClose(ref tCamera Camera)
 {
     // Reset the trigger mode.
     Pv.AttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun");
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
     // Delete the allocated buffer.
     Camera.GC.Free();
     // Reset the handle.
     Camera.Handle = 0;
 }
Esempio n. 7
0
        // Close the camera.
        static void CameraClose()
        {
            Thread.Sleep(1000);
            // Unsetup event channel.
            Pv.AttrUint32Set(GCamera.Handle, "EventsEnable1", 0);
            Pv.CameraEventCallbackUnRegister(GCamera.Handle, EventDone);

            // Clear the queue.
            Console.WriteLine("Clearing the queue...");
            Pv.CaptureQueueClear(GCamera.Handle);
            // close the camera
            Console.WriteLine("The camera is now closed.");
            Pv.CameraClose(GCamera.Handle);
        }
Esempio n. 8
0
 // Close the camera.
 static void CameraClose(ref tCamera Camera)
 {
     // Dequeue all the frame still queued (this will block until they all have been dequeued).
     Pv.CaptureQueueClear(Camera.Handle);
     // Reset the trigger mode.
     Pv.AttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun");
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
     Console.WriteLine("camera is closed, deleting the frames now");
     // Delete the allocated buffer.
     Camera.GC.Free();
     // Reset the handle.
     Camera.Handle = 0;
 }
Esempio n. 9
0
 // Close the camera.
 static void CameraClose(ref tCamera Camera)
 {
     // Reset the trigger mode.
     Pv.AttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun");
     // Clear the queue.
     Console.WriteLine("Clearing the queue...");
     Pv.CaptureQueueClear(Camera.Handle);
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
     Console.WriteLine("Closing the camera.");
     // Delete the allocated buffer.
     Camera.GC.Free();
     // Reset the handle.
     Camera.Handle = 0;
 }
Esempio n. 10
0
 public void Open()
 {
     if (!camera.HasValue)
     {
         uint cameraId;
         Pv.CameraClose(cameraInfo.UniqueId);
         tErr err = Pv.CameraOpen(cameraInfo.UniqueId, tAccessFlags.eAccessMaster, out cameraId);
         if (err != tErr.eErrSuccess)
         {
             throw new PvException(err);
         }
         camera = cameraId;
         communicationManager = new CommunicationsManager(cameraId);
         CommunicationManager.TransmitCommand(new ValuelessCommand((byte)CommandCode.Initialize));
     }
 }
Esempio n. 11
0
        public void Close()
        {
            if (camera.HasValue)
            {
                tErr err = Pv.CameraClose(camera.Value);
                camera = null;
                if (err != tErr.eErrSuccess)
                {
                    throw new PvException(err);
                }
            }

            if (CommunicationManager != null)
            {
                CommunicationManager.Dispose();
            }
        }
Esempio n. 12
0
 // Close the camera.
 static void CameraClose(ref tCamera Camera)
 {
     // Close the camera.
     Pv.CameraClose(Camera.Handle);
 }