Example #1
0
 public void Stop()
 {
     if (!_isAcquiring)
     {
         return;
     }
     CheckError(IMAQdx.IMAQdxStopAcquisition(session));
     CheckError(IMAQdx.IMAQdxUnconfigureAcquisition(session));
     _isAcquiring = false;
 }
Example #2
0
 public void Start(uint bufferCount)
 {
     if (_isAcquiring)
     {
         return;
     }
     CheckError(IMAQdx.IMAQdxConfigureAcquisition(session, true, bufferCount));
     CheckError(IMAQdx.IMAQdxStartAcquisition(session));
     _isAcquiring = true;
 }
Example #3
0
 public void Dispose()
 {
     if (isDisposed)
     {
         return;
     }
     Stop();
     CheckError(IMAQdx.IMAQdxCloseCamera(session));
     isDisposed = true;
 }
Example #4
0
        /*
         *
         * /// <summary>
         * /// Extract the next image
         * /// </summary>
         * /// <returns></returns>
         * public Image8 Extract() {
         *  var image = new Image8(width, height);
         *  var bufferLength = (uint)(width * height);
         *  uint frameIndex;
         *  CheckError(IMAQdx.IMAQdxGetImageData(session, image.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeNext, 0, out frameIndex));
         *  return image;
         * }
         *
         * /// <summary>
         * /// Extract the next image and return its index
         * /// </summary>
         * /// <param name="frameIndex"></param>
         * /// <returns></returns>
         * public Image8 Extract(out uint frameIndex) {
         *  var image = new Image8(width, height);
         *  var bufferLength = (uint)(width * height);
         *  CheckError(IMAQdx.IMAQdxGetImageData(session, image.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeNext, 0, out frameIndex));
         *  return image;
         * }
         *
         * /// <summary>
         * /// Extract the image with the specified index
         * /// </summary>
         * /// <param name="frameIndex"></param>
         * /// <returns></returns>
         * public Image8 Extract(uint frameIndex) {
         *  var image = new Image8(width, height);
         *  uint actualFrameIndex;
         *  CheckError(IMAQdx.IMAQdxGetImageData(session, image.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeBufferNumber, frameIndex, out actualFrameIndex));
         *  if (actualFrameIndex != frameIndex)
         *      System.Diagnostics.Debug.WriteLine("Warning: Expected frameIndex " + frameIndex + ", got frameIndex " + actualFrameIndex);
         *  return image;
         * }
         *
         * /// <summary>
         * /// Extract the next image into an existing Image8
         * /// </summary>
         * /// <param name="imageToReuse"></param>
         * public void Extract(Image8 imageToReuse) {
         *  if (imageToReuse.Width != width || imageToReuse.Height != height)
         *      throw new Exception("Cannot reuse image, dimensions should be " + width + " x " + height + ", not " + imageToReuse.Width + " x " + imageToReuse.Height);
         *  uint frameIndex;
         *  CheckError(IMAQdx.IMAQdxGetImageData(session, imageToReuse.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeNext, 0, out frameIndex));
         * }
         *
         * /// <summary>
         * /// Extract the next image into an existing Image8 and return its index
         * /// </summary>
         * /// <param name="frameIndex"></param>
         * /// <returns></returns>
         * public void Extract(Image8 imageToReuse, out uint frameIndex) {
         *  if (imageToReuse.Width != width || imageToReuse.Height != height)
         *      throw new Exception("Cannot reuse image, dimensions should be " + width + " x " + height + ", not " + imageToReuse.Width + " x " + imageToReuse.Height);
         *  CheckError(IMAQdx.IMAQdxGetImageData(session, imageToReuse.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeNext, 0, out frameIndex));
         * }*/

        /// <summary>
        /// Extract the image with the specified index into an existing Image8
        /// </summary>
        /// <param name="frameIndex"></param>
        /// <returns></returns>
        public void Extract(Image8 imageToReuse, uint frameIndex)
        {
            uint actualFrameIndex;

            CheckError(IMAQdx.IMAQdxGetImageData(session, imageToReuse.Image, bufferLength, IMAQdx.IMAQdxBufferNumberMode.IMAQdxBufferNumberModeBufferNumber, frameIndex, out actualFrameIndex));
            if (actualFrameIndex != frameIndex)
            {
                System.Diagnostics.Debug.WriteLine("Warning: Expected frameIndex " + frameIndex + ", got frameIndex " + actualFrameIndex);
            }
        }
Example #5
0
        public IMAQCamera(string name)
        {
            CheckError(IMAQdx.IMAQdxOpenCamera(name, IMAQdx.IMAQdxCameraControlMode.IMAQdxCameraControlModeController, out session));
            uint widthTemp;
            uint heightTemp;

            IMAQdx.IMAQdxGetAttribute(session, IMAQdx.IMAQdxAttributeWidth, IMAQdx.IMAQdxValueType.IMAQdxValueTypeU32, out widthTemp);
            IMAQdx.IMAQdxGetAttribute(session, IMAQdx.IMAQdxAttributeHeight, IMAQdx.IMAQdxValueType.IMAQdxValueTypeU32, out heightTemp);
            width  = (int)widthTemp;
            height = (int)heightTemp;
            if (width % 4 != 0)
            {
                Width = (int)(Math.Ceiling(width / 4.0) * 4);
            }
            bufferLength = (uint)(width * height);
        }