Пример #1
0
 private void Start()
 {
     _camera    = Camera.main;
     _calibrate = _camera.GetComponent <Calibrate>();
     thisjoint  = this.ToString();
     thisjoint  = thisjoint.Remove(thisjoint.IndexOf(' '), thisjoint.Length - thisjoint.IndexOf(' '));
 }
Пример #2
0
 private void Awake()
 {
     calibrate = FindObjectOfType <Calibrate>();
     if (PlayerPrefs.HasKey("MaxMotorTorque"))
     {
         LoadParameters();
     }
     else
     {
         DefaultConfig();
     }
 }
Пример #3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public CvLabViewModel()
        {
            SwitchCameraCommand = new DelegateCommand();
            SwitchCameraCommand.ExecuteCommand = new Action <object>(SwitchCameraAction);
            RefreshCameraCommand = new DelegateCommand();
            RefreshCameraCommand.ExecuteCommand = new Action <object>(RefreshCameraAction);
            ReleaseCameraCommand = new DelegateCommand();
            ReleaseCameraCommand.ExecuteCommand    = new Action <object>(ReleaseCameraAction);
            DefaultCalibParaCommand                = new DelegateCommand();
            DefaultCalibParaCommand.ExecuteCommand = new Action <object>(DefaultCalibParaActioon);
            DoCalibrateCommand = new DelegateCommand();
            DoCalibrateCommand.ExecuteCommand = new Action <object>(DoCalibrateAction);
            m_calibrate = new Calibrate();

            RefreshCamera();
        }
Пример #4
0
 void Start()
 {
     calibrateScript = this.GetComponent<Calibrate>();
     testingScript = this.GetComponent<TestingManager>();
     path = Application.persistentDataPath + "/" + fileName + "." + trialNum + ".txt";
     if (!System.IO.File.Exists( path ))
     {
         // Create a file to write to.
         string createText = "Initiate Data " + System.Environment.NewLine;
         System.IO.File.WriteAllText(path, createText);
     }
     else {
         string addText = "New Data Entry " + System.Environment.NewLine;
         System.IO.File.AppendAllText(path, addText);
     }
 }
Пример #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            bool isfind = false;

            foreach (Form fm in Application.OpenForms)
            {
                //判断Form2是否存在,如果在激活并给予焦点
                if (fm.Name == "Calibrate")
                {
                    fm.WindowState = FormWindowState.Maximized;
                    fm.WindowState = FormWindowState.Normal;
                    fm.Activate();
                    return;
                }
            }
            //如果窗口不存在,打开窗口
            if (!isfind)
            {
                Form fm = new Calibrate(); fm.Show();
            }
        }
Пример #6
0
        public CalibrateForm(DataProcessing dataProcessing)
        {
            InitializeComponent();
            _dataProcessing = dataProcessing;

            calibrate           = new Calibrate();
            calibrateLoginLogic = new CalibrateLogin();
            this.Visible        = false; //CalibrateForm skjules

            _calibrateLoginForm = new CalibrateLoginForm(calibrateLoginLogic, this);
            _calibrateLoginForm.ShowDialog();

            if (this.LoginOK_ == true)
            {
                this.Visible = true;
            }
            else
            {
                this.Close();
            }
        }
Пример #7
0
 void Start()
 {
     calibrate = FindObjectOfType <Calibrate>();
 }
Пример #8
0
 void Start()
 {
     calibrationComponent = GetComponent <Calibrate>();
 }
Пример #9
0
        private void SetCapVars()
        {
            _ledData     = DataUtil.GetObject <LedData>("LedData");
            _captureMode = DataUtil.GetItem <int>("CaptureMode");
            _camType     = DataUtil.GetItem <int>("CamType");
            LogUtil.Write("Capture mode is " + _captureMode);
            switch (_captureMode)
            {
            // If camera mode
            case 1: {
                _camWidth    = DataUtil.GetItem <int>("CamWidth") ?? 1920;
                _camHeight   = DataUtil.GetItem <int>("CamHeight") ?? 1080;
                _scaleFactor = DataUtil.GetItem <float>("ScaleFactor") ?? .5f;
                _scaleWidth  = Convert.ToInt32(_camWidth * _scaleFactor);
                _scaleHeight = Convert.ToInt32(_camHeight * _scaleFactor);
                _srcArea     = _scaleWidth * _scaleHeight;
                _scaleSize   = new Size(_scaleWidth, _scaleHeight);

                // If we have a pi cam, we can attempt to calibrate for warping
                if (_camType == 0)
                {
                    var kStr = DataUtil.GetItem("K");
                    if (kStr == null)
                    {
                        LogUtil.Write("Running static camera calibration.");
                        Calibrate.ProcessFrames();
                    }
                    else
                    {
                        LogUtil.Write("Camera calibration settings loaded.");
                    }

                    LogUtil.Write("calibration vars deserialized.");
                }

                // If it is an actual cam, versus USB video capture, get a lock target
                try {
                    var lt = DataUtil.GetItem <PointF[]>("LockTarget");
                    LogUtil.Write("LT Grabbed? " + JsonConvert.SerializeObject(lt));
                    if (lt != null)
                    {
                        _lockTarget = new VectorOfPointF(lt);
                        var lC = 0;
                        while (lC < 20)
                        {
                            _targets.Add(VPointFToVPoint(_lockTarget));
                            lC++;
                        }
                    }
                } catch (Exception e) {
                    LogUtil.Write("Exception: " + e.Message);
                }

                break;
            }

            // If capturing HDMI input or screen
            case 2:
            case 3:
                _camWidth    = 640;
                _camHeight   = 480;
                _scaleFactor = 1;
                _scaleWidth  = Convert.ToInt32(_camWidth * _scaleFactor);
                _scaleHeight = Convert.ToInt32(_camHeight * _scaleFactor);
                _srcArea     = _scaleWidth * _scaleHeight;
                _scaleSize   = new Size(_scaleWidth, _scaleHeight);
                break;
            }

            var tl = new Point(0, 0);
            var tr = new Point(_scaleWidth, 0);
            var br = new Point(_scaleWidth, _scaleHeight);
            var bl = new Point(0, _scaleHeight);

            // Debugging vars...
            _showSource = DataUtil.GetItem <bool>("ShowSource") ?? false;
            _showEdged  = DataUtil.GetItem <bool>("ShowEdged") ?? false;
            _showWarped = DataUtil.GetItem <bool>("ShowWarped") ?? false;
            _vectors    = new PointF[] { tl, tr, br, bl };
            LogUtil.Write("Start Capture should be running...");
        }
Пример #10
0
 public void SetUp()
 {
     uut = new Calibrate();
 }
Пример #11
0
 static void Init()
 {
     Calibrate window = (Calibrate)EditorWindow.GetWindow(typeof(Calibrate));
 }