Beispiel #1
0
        private void Initialize()
        {
            CamApiStatus status;

            if (this.camSystem == null)
            {
                // Create instance.
                this.camSystem = new CameraSystem();

                this.arrayCamDevice = new CameraDevice[MaxCameraCount];

                // Initialize Api
                status = this.camSystem.Initialize();
                if (status != CamApiStatus.Success)
                {
                    MessageBox.Show("Initialize error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prepare table for converting YUV image to BGRA.
                status = CameraUtility.PrepareLUT();
                if (status != CamApiStatus.Success)
                {
                    MessageBox.Show("PrepareLUT error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                this.arrayTextBoxInfoCam    = new TextBox[MaxCameraCount];
                this.arrayTextBoxInfoCam[0] = this.textBoxInfoCam1;
                this.arrayTextBoxInfoCam[1] = this.textBoxInfoCam2;
                this.arrayTextBoxInfoCam[2] = this.textBoxInfoCam3;
                this.arrayTextBoxInfoCam[3] = this.textBoxInfoCam4;

                this.arrayTextBoxFps    = new TextBox[MaxCameraCount];
                this.arrayTextBoxFps[0] = this.textBoxFps1;
                this.arrayTextBoxFps[1] = this.textBoxFps2;
                this.arrayTextBoxFps[2] = this.textBoxFps3;
                this.arrayTextBoxFps[3] = this.textBoxFps4;

                this.arrayTextBoxBlockId    = new TextBox[MaxCameraCount];
                this.arrayTextBoxBlockId[0] = this.textBoxBlockId1;
                this.arrayTextBoxBlockId[1] = this.textBoxBlockId2;
                this.arrayTextBoxBlockId[2] = this.textBoxBlockId3;
                this.arrayTextBoxBlockId[3] = this.textBoxBlockId4;

                this.arrayNumericUpDownGain    = new NumericUpDown[MaxCameraCount];
                this.arrayNumericUpDownGain[0] = this.numericUpDownGain1;
                this.arrayNumericUpDownGain[1] = this.numericUpDownGain2;
                this.arrayNumericUpDownGain[2] = this.numericUpDownGain3;
                this.arrayNumericUpDownGain[3] = this.numericUpDownGain4;

                this.arrayNumericUpDownFrameRate    = new NumericUpDown[MaxCameraCount];
                this.arrayNumericUpDownFrameRate[0] = this.numericUpDownFrameRate1;
                this.arrayNumericUpDownFrameRate[1] = this.numericUpDownFrameRate2;
                this.arrayNumericUpDownFrameRate[2] = this.numericUpDownFrameRate3;
                this.arrayNumericUpDownFrameRate[3] = this.numericUpDownFrameRate4;

                this.arrayPictureBox    = new PictureBox[MaxCameraCount];
                this.arrayPictureBox[0] = this.pictureBox1;
                this.arrayPictureBox[1] = this.pictureBox2;
                this.arrayPictureBox[2] = this.pictureBox3;
                this.arrayPictureBox[3] = this.pictureBox4;

                this.arrayLabelErrorMessage    = new Label[MaxCameraCount];
                this.arrayLabelErrorMessage[0] = this.labelErrorMessage1;
                this.arrayLabelErrorMessage[1] = this.labelErrorMessage2;
                this.arrayLabelErrorMessage[2] = this.labelErrorMessage3;
                this.arrayLabelErrorMessage[3] = this.labelErrorMessage4;

                this.arrayTabPage    = new TabPage[MaxCameraCount];
                this.arrayTabPage[0] = this.tabPage1;
                this.arrayTabPage[1] = this.tabPage2;
                this.arrayTabPage[2] = this.tabPage3;
                this.arrayTabPage[3] = this.tabPage4;

                this.arrayFpsCount = new int[MaxCameraCount];
            }
        }