コード例 #1
0
        private const int FULL_BIT_DEPTH = 12; // ADC max res. = 12 for Prosilica GC1380

        public ImageFormat()
        {
            pixelformat   = tImageFormat.eFmtMono8;
            bytesperframe = 1392640;
            height        = 1024;
            regionx       = 0;
            regiony       = 0;
            width         = 1360;
        }
コード例 #2
0
        private const int FULL_BIT_DEPTH = 12; // ADC max res. = 12 for Prosilica GC1380

        public ImageFormat()
        {
            pixelformat = tImageFormat.eFmtMono8;
            bytesperframe = 1392640;
            height = 1024;
            regionx = 0;
            regiony = 0;
            width = 1360;
        }
コード例 #3
0
ファイル: Camera.cs プロジェクト: saihv/EERILControlSystem
        public void BeginCapture(tImageFormat fmt)
        {
            tErr error;
            if (!camera.HasValue)
            {
                error = tErr.eErrUnavailable;
                throw new PvException(error);
            }

            ImageFormat.pixelformat = fmt;

            error = Pv.CaptureStart(camera.Value);
            if (error != tErr.eErrSuccess)
                goto error;

            frameBufferHandles = new GCHandle[FRAME_POOL_SIZE];
            framePoolHandles = new GCHandle[FRAME_POOL_SIZE];
            frames = new tFrame[FRAME_POOL_SIZE];

            uint bufferSize = 0;
            error = Pv.AttrUint32Get(camera.Value, "TotalBytesPerFrame", ref bufferSize);
            if (error != tErr.eErrSuccess)
                goto error;
            for (int count = FRAME_POOL_SIZE - 1; count >= 0; count--)
            {
                byte[] buffer = new byte[bufferSize];
                GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                frameBufferHandles[count] = bufferHandle;
                tFrame frame = new tFrame
                {
                    ImageBuffer = bufferHandle.AddrOfPinnedObject(),
                    ImageBufferSize = bufferSize,
                    AncillaryBufferSize = 0
                };
                frames[count] = frame;
                GCHandle frameHandle = GCHandle.Alloc(frame, GCHandleType.Pinned);
                framePoolHandles[count] = frameHandle;
                IntPtr framePointer = frameHandle.AddrOfPinnedObject();
                buffers.Add(framePointer, buffer);
                if (!communicationManager.QueueFrame(framePointer, callback))
                    goto error;
            }
            this.FrameRate = 30;
            error = Pv.AttrEnumSet(this.camera.Value, "FrameStartTriggerMode", "FixedRate");
            if (error != tErr.eErrSuccess)
                goto error;
            error = Pv.AttrEnumSet(this.camera.Value, "AcquisitionMode", "Continuous");
            if (error != tErr.eErrSuccess)
                goto error;
            error = Pv.CommandRun(this.camera.Value, "AcquisitionStart");
            if (error != tErr.eErrSuccess)
                goto error;
            return;
            error:
            EndCapture();

            throw new PvException(error);
        }
コード例 #4
0
ファイル: Camera.cs プロジェクト: msled/EERILControlSystem
        public void BeginCapture(tImageFormat fmt)
        {
            tErr error;

            if (!camera.HasValue)
            {
                error = tErr.eErrUnavailable;
                throw new PvException(error);
            }

            ImageFormat.pixelformat = fmt;

            error = Pv.CaptureStart(camera.Value);
            if (error != tErr.eErrSuccess)
            {
                goto error;
            }

            frameBufferHandles = new GCHandle[FRAME_POOL_SIZE];
            framePoolHandles   = new GCHandle[FRAME_POOL_SIZE];
            frames             = new tFrame[FRAME_POOL_SIZE];

            uint bufferSize = 0;

            error = Pv.AttrUint32Get(camera.Value, "TotalBytesPerFrame", ref bufferSize);
            if (error != tErr.eErrSuccess)
            {
                goto error;
            }
            for (int count = FRAME_POOL_SIZE - 1; count >= 0; count--)
            {
                byte[]   buffer       = new byte[bufferSize];
                GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                frameBufferHandles[count] = bufferHandle;
                tFrame frame = new tFrame
                {
                    ImageBuffer         = bufferHandle.AddrOfPinnedObject(),
                    ImageBufferSize     = bufferSize,
                    AncillaryBufferSize = 0
                };
                frames[count] = frame;
                GCHandle frameHandle = GCHandle.Alloc(frame, GCHandleType.Pinned);
                framePoolHandles[count] = frameHandle;
                IntPtr framePointer = frameHandle.AddrOfPinnedObject();
                buffers.Add(framePointer, buffer);
                if (!communicationManager.QueueFrame(framePointer, callback))
                {
                    goto error;
                }
            }
            this.FrameRate = 30;
            error          = Pv.AttrEnumSet(this.camera.Value, "FrameStartTriggerMode", "FixedRate");
            if (error != tErr.eErrSuccess)
            {
                goto error;
            }
            error = Pv.AttrEnumSet(this.camera.Value, "AcquisitionMode", "Continuous");
            if (error != tErr.eErrSuccess)
            {
                goto error;
            }
            error = Pv.CommandRun(this.camera.Value, "AcquisitionStart");
            if (error != tErr.eErrSuccess)
            {
                goto error;
            }
            return;

error:
            EndCapture();

            throw new PvException(error);
        }