// 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); } }
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)); } }
// Open the camera. static bool CameraSetup() { return(Pv.CameraOpen(GCamera.UID, tAccessFlags.eAccessMaster, out GCamera.Handle) == 0); }
// Open the camera. static bool CameraOpen(ref tCamera Camera) { return(Pv.CameraOpen(Camera.UID, tAccessFlags.eAccessMaster, out Camera.Handle) == 0); }