Пример #1
0
        public Form1()
        {
            InitializeComponent();

            // Set up initial button states
            startButton.Enabled = true;
            stopButton.Enabled  = false;
            startButton.Enabled = false;

            // Set up image viewer
            VisionImage image = new VisionImage();

            imageViewer.Attach(image);

            // Enumerate cameras and update controls
            ImaqdxCameraInformation[] cameras = ImaqdxSystem.GetCameraInformation(true);
            foreach (ImaqdxCameraInformation camera in cameras)
            {
                cameraName.Items.Add(camera.Name);
            }
            cameraName.SelectedIndex = cameraName.Items.Count > 0 ? 0 : -1;

            // Set up background acquisition worker
            acquisitionWorker                            = new System.ComponentModel.BackgroundWorker();
            acquisitionWorker.DoWork                    += new DoWorkEventHandler(acquisitionWorker_DoWork);
            acquisitionWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(acquisitionWorker_RunWorkerCompleted);
            acquisitionWorker.ProgressChanged           += new ProgressChangedEventHandler(acquisitionWorker_ProgressChanged);
            acquisitionWorker.WorkerReportsProgress      = true;
            acquisitionWorker.WorkerSupportsCancellation = true;
        }
        /// <summary>
        /// 获得相机 设备列表
        /// </summary>
        /// <returns></returns>
        public static List <string> GetCameraList()
        {
            List <string> CameraList = new List <string>();
            var           cameraList = ImaqdxSystem.GetCameraInformation(true);

            foreach (var camera in cameraList)
            {
                CameraList.Add(camera.Name);
            }

            return(CameraList);
        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();

            // Initialize UI controls
            startButton.Enabled    = true;
            quitButton.Enabled     = true;
            imageScrollBar.Enabled = false;

            // Enumerate cameras and update control
            ImaqdxCameraInformation[] cameraList = ImaqdxSystem.GetCameraInformation(true);

            if (cameraList.Length > 0)
            {
                cameraComboBox.Items.Clear();
                foreach (ImaqdxCameraInformation camInfo in cameraList)
                {
                    cameraComboBox.Items.Add(camInfo.Name);
                }
                cameraComboBox.SelectedIndex = 0;
            }
        }
Пример #4
0
        public void TestGetCameraInformation()
        {
            bool testResult = true;

            try
            {
                ImaqdxCameraInformation[] cameraList = ImaqdxSystem.GetCameraInformation(true);
                if (cameraList.Length == 0)
                {
                    testResult = false;
                }

                Assert.True(cameraList.Length != 0, "Failed: No camera connected");
            }
            catch (ArgumentNullException e)
            {
                testResult = false;
            }
            finally
            {
                Assert.True(testResult, "Failed: No camera connected");
            }
        }
Пример #5
0
        public Form1()
        {
            InitializeComponent();

            startButton.Enabled = true;

            // Enumerate cameras and populate control
            ImaqdxCameraInformation[] cameraList = ImaqdxSystem.GetCameraInformation(true);

            if (cameraList.Length > 0)
            {
                cameraComboBox.Items.Clear();
                foreach (ImaqdxCameraInformation camInfo in cameraList)
                {
                    cameraComboBox.Items.Add(camInfo.Name);
                }
                cameraComboBox.SelectedIndex = 0;
            }

            // Create image and attach to viewer
            image = new VisionImage();
            imageViewer.Attach(image);
        }
Пример #6
0
        public Form1()
        {
            InitializeComponent();

            // Set up initial UI state
            startButton.Enabled                  = true;
            stopButton.Enabled                   = false;
            numberOfBuffersControl.Enabled       = true;
            acquisitionModeComboBox.Enabled      = true;
            bufferWaitMode.Enabled               = true;
            cameraComboBox.Enabled               = true;
            acquisitionModeComboBox.DataSource   = Enum.GetValues(typeof(ImaqdxAcquisitionType));
            acquisitionModeComboBox.SelectedItem = ImaqdxAcquisitionType.Continuous;
            bufferWaitMode.Items.AddRange(new string[]  { "Next", "Last", "BufferNumber" });
            bufferWaitMode.SelectedItem = "BufferNumber";

            // Enumerate available cameras
            ImaqdxCameraInformation[] cameraList = ImaqdxSystem.GetCameraInformation(true);
            foreach (ImaqdxCameraInformation camInfo in cameraList)
            {
                cameraComboBox.Items.Add(camInfo.Name);
            }
            cameraComboBox.SelectedIndex = cameraList.Length > 0 ? 0 : -1;

            // Set up image viewer
            VisionImage image = new VisionImage();

            imageViewer.Attach(image);

            // Set up background acquisition worker
            acquisitionWorker                            = new System.ComponentModel.BackgroundWorker();
            acquisitionWorker.DoWork                    += new DoWorkEventHandler(acquisitionWorker_DoWork);
            acquisitionWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(acquisitionWorker_RunWorkerCompleted);
            acquisitionWorker.ProgressChanged           += new ProgressChangedEventHandler(acquisitionWorker_ProgressChanged);
            acquisitionWorker.WorkerReportsProgress      = true;
            acquisitionWorker.WorkerSupportsCancellation = true;
        }