Esempio n. 1
0
 public Modeller(KinectScanContext context)
 {
     Context = context;
     InitHardwareAcceleration();
     StopARE      = new AutoResetEvent(false);
     RefreshTimer = new System.Threading.Timer(Refresh, null, 1000, 20);
 }
Esempio n. 2
0
        public KinectScanModule(KinectScanContext context)
        {
            Context = context;

            Turntable.DeviceConnected    += (object sender, EventArgs e) => { Context.ShowTrayMessage("KinectScan", LocalizedResources.TurntableConnected, ToolTipIcon.Info); };
            Turntable.DeviceDisconnected += (object sender, EventArgs e) => { Context.ShowTrayMessage("KinectScan", LocalizedResources.TurntableDisconnected, ToolTipIcon.Info); };

            Context.ProgramClosing += Context_ProgramClosing;

            RSF = new RotationScannerForm(context);
            RSF.Show();
        }
Esempio n. 3
0
        public TurntableCalibrationForm(KinectScanContext context)
        {
            Context = context;
            InitializeComponent();
            Context.DeviceDisposing += Context_DeviceDisposing;
            RM = new ResourceManager(typeof(LocalizedResources));
            SetStep(1);
            ClientSize              = new System.Drawing.Size(Context.DepthWidth, Context.DepthHeight + 128);
            PHelp.Width             = PImage.Width = Context.DepthHeight;
            TLP.RowStyles[0].Height = Context.DepthHeight;
            PHelp.PerformLayout();

            SC             = SynchronizationContext.Current;
            TableA         = ModuleSettings.Default.CalibrationTableA;
            TableB         = ModuleSettings.Default.CalibrationTableB;
            StandardA      = ModuleSettings.Default.CalibrationCylinderA;
            StandardB      = ModuleSettings.Default.CalibrationCylinderB;
            Calibrator     = new TurntableCalibrator(Context);
            G3D            = new Graphics3D(Context.DepthWidth, Context.DepthHeight);
            G3D.Projection = Context.DepthIntrinsics;
        }
Esempio n. 4
0
 private void InitModules()
 {
     KSC                        = new KinectScanContext();
     KSC.DepthA                 = DepthA;
     KSC.DepthB                 = DepthB;
     KSC.DepthC                 = DepthC;
     KSC.DepthWidth             = 640;
     KSC.DepthHeight            = 480;
     KSC.DepthCalibrationWidth  = 1280;
     KSC.DepthCalibrationHeight = 1024;
     KSC.DepthIntrinsics        = DepthIntrinsics;
     KSC.DepthInverseIntrinsics = DepthInverseIntrinsics;
     KSC.DepthCorrection        = DepthCorrection;
     KSC.ColorCorrection        = VideoCorrection;
     KSC.OnDepthZLimitChanged(SF.NBZLimit.Value);
     KSC.OnTriangleRemoveLimitChanged(SF.NBTriangleRemove.Value);
     KSC.OnReprojectionChanged(SF.NBReprojectionTranslationX.Value, SF.NBReprojectionTranslationY.Value, SF.NBReprojectionTranslationZ.Value, SF.NBReprojectionRotationX.Value, SF.NBReprojectionRotationY.Value, SF.NBReprojectionRotationZ.Value);
     KSC.WorkingDirectory    = WorkingDirectory;
     KSC.StartVirtualDevice += KSC_StartVirtualDevice;
     KSC.StartKinectDevice  += KSC_StartKinectDevice;
     KSC.ChangeUIMode       += KSC_ChangeUIMode;
     KSC.MessageReceived    += KSC_MessageReceived;
     MM = new ModuleManager(KSC);
     MM.LoadAvailableModules();
     foreach (ModuleManager.ModuleInfo module in MM.AvailableModules)
     {
         if (SC.IsModuleActivated(module.ID))
         {
             MenuItem MIModule = new MenuItem(module.Name);
             MIModule.Tag    = module;
             MIModule.Click += MIModule_Click;
             MIModules.MenuItems.Add(MIModule);
         }
     }
     MIModules.Visible = MIModules.MenuItems.Count > 0;
 }
Esempio n. 5
0
 public TurntableCalibrator(KinectScanContext context)
 {
     Context      = context;
     IsCalibrated = false;
 }
Esempio n. 6
0
 public ExCoreModeller(KinectScanContext context)
     : base(context)
 {
     NextExCoreClear = new bool[2];
     ExCoreTick      = new bool[2];
 }
Esempio n. 7
0
        public RotationScannerForm(KinectScanContext context)
        {
            InitializeComponent();
            Context = context;

            //Modeller
            Modeller = new ExCoreModeller(Context);
            Modeller.CreateDevice(XPanel);
            Modeller.DebugLoad();

            //GUI
            Array ViewModes = Enum.GetValues(typeof(Modeller.Views));

            string[] specialViewModes = Modeller.SpecialViewModes;

            MenuItem MI;

            foreach (Modeller.Views mode in ViewModes)
            {
                if (mode == KinectScan.Modeller.Views.Special && specialViewModes.Length > 0)
                {
                    continue;
                }
                MI            = new MenuItem(mode.ToString());
                MI.RadioCheck = true;
                if (Modeller.ViewMode == mode)
                {
                    MI.Checked     = true;
                    MISelectedView = MI;
                }
                MI.Click += (object sender, EventArgs e) =>
                {
                    if (MISelectedView != null)
                    {
                        MISelectedView.Checked = false;
                    }
                    MISelectedView         = (MenuItem)sender;
                    MISelectedView.Checked = true;
                    Modeller.ViewMode      = (Modeller.Views)MISelectedView.Tag;
                };
                MI.Tag = mode;
                MIView.MenuItems.Add(MI);
            }

            if (specialViewModes.Length > 0)
            {
                int i = 0;
                MIView.MenuItems.Add(new MenuItem("-"));
                foreach (string mode in specialViewModes)
                {
                    MI            = new MenuItem(mode.ToString());
                    MI.RadioCheck = true;
                    MI.Checked    = (Modeller.ViewMode == Modeller.Views.Special && Modeller.SpecialViewMode == i);
                    MI.Click     += (object sender, EventArgs e) =>
                    {
                        if (MISelectedView != null)
                        {
                            MISelectedView.Checked = false;
                        }
                        MISelectedView           = (MenuItem)sender;
                        MISelectedView.Checked   = true;
                        Modeller.ViewMode        = KinectScan.Modeller.Views.Special;
                        Modeller.SpecialViewMode = (int)MISelectedView.Tag;
                    };
                    MI.Tag = i++;
                    MIView.MenuItems.Add(MI);
                }
            }

            MIViewLegs.MenuItems[Modeller.VisualizedLeg].Checked = true;

            XPanel.KeyDown += (object o, KeyEventArgs e) => {
                switch (e.KeyCode)
                {
                case Keys.Space:
                    MIScan_Click(this, null);
                    break;

                case Keys.Tab:
                    TScan.Start();
                    break;
                }
            };

            //Settings
            SF = new TurntableSettingsForm();
            SF.LoadSettings();
            SF.SetModeller(Modeller);

            //Scanning
            ScanUITimer          = new Timer();
            ScanUITimer.Interval = 100;
            ScanUITimer.Tick    += (object sender, EventArgs e) =>
            {
                if (ScanningState == ScanningStates.Scanning)
                {
                    int degrees = (int)Turntable.PositionInDegrees;
                    TSPB.Value = degrees;
                    TSSL.Text  = string.Format(LocalizedResources.ScannerScanning, degrees);
                }
            };
            SetState(ScanningStates.None);
            Context.ScannerCreated += Context_ScannerCreated;
            if (Context.Scanner != null)
            {
                Context_ScannerCreated(this, null);
            }
            Turntable.DeviceConnected    += Turntable_DeviceConnected;
            Turntable.DeviceDisconnected += Turntable_DeviceDisconnected;
            TScan          = new Timer();
            TScan.Interval = 20000;
            TScan.Tick    += (object sender, EventArgs e) => { MIScan_Click(this, null); TScan.Stop(); };
        }