Inheritance: IKinectSettings
Exemplo n.º 1
0
        public KinectCoreV2(ref KinectBase.MasterSettings settings, bool isGUILaunched, int kinectNumber)
        {
            masterSettings = settings;
            dynamic temp = masterSettings.kinectOptionsList[kinectNumber];
            masterKinectSettings = (KinectV2Settings)temp;

            //TODO: Update this to open a specific Kinect v2, if the SDK is ever updated to support multiple on one machine
            kinect = KinectSensor.GetDefault();
            kinectID = kinectNumber;

            uint tempC = kinect.ColorFrameSource.FrameDescription.LengthInPixels;
            uint tempD = kinect.DepthFrameSource.FrameDescription.LengthInPixels;
            uint tempI = kinect.InfraredFrameSource.FrameDescription.LengthInPixels;
            colorImagePool = new KinectBase.ObjectPool<byte[]>(() => new byte[tempC * 4]);
            depthImagePool = new KinectBase.ObjectPool<byte[]>(() => new byte[tempD * 4]);
            irImagePool = new KinectBase.ObjectPool<byte[]>(() => new byte[tempI * sizeof(UInt16)]);

            if (isGUILaunched)
            {
                isGUI = true;
                LaunchKinect();
            }
            else
            {
                launchKinectDelegate kinectDelegate = LaunchKinect;
                IAsyncResult result = kinectDelegate.BeginInvoke(null, null);
                kinectDelegate.EndInvoke(result);  //Even though this is blocking, the events should be on a different thread now.
            }
        }
        public KinectV2SettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.KinectV2)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (KinectV2Settings)tempSettings;
                    kinectID = kinectNumber;
                    kinectCore = (KinectCoreV2)kinect;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();
                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a Kinect v2 sensor.");
                }
            }
            else
            {
                throw new NotSupportedException("Method arguments are invalid!");
            }
        }
Exemplo n.º 3
0
        public KinectV2SettingsControl(int kinectNumber, ref KinectBase.MasterSettings settings, KinectBase.IKinectCore kinect)
        {
            if (settings != null)
            {
                if (settings.kinectOptionsList[kinectNumber].version == KinectBase.KinectVersion.KinectV2)
                {
                    masterSettings = settings;
                    dynamic tempSettings = settings.kinectOptionsList[kinectNumber];
                    kinectSettings = (KinectV2Settings)tempSettings;
                    kinectID       = kinectNumber;
                    kinectCore     = (KinectCoreV2)kinect;
                    uniqueKinectID = kinect.uniqueKinectID;

                    InitializeComponent();
                    this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    this.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
                }
                else
                {
                    throw new ArgumentException("The provided KinectID is not for a Kinect v2 sensor.");
                }
            }
            else
            {
                throw new NotSupportedException("Method arguments are invalid!");
            }
        }
Exemplo n.º 4
0
        public KinectCoreV2(ref KinectBase.MasterSettings settings, bool isGUILaunched, int kinectNumber)
        {
            masterSettings = settings;
            dynamic temp = masterSettings.kinectOptionsList[kinectNumber];

            masterKinectSettings = (KinectV2Settings)temp;

            //TODO: Update this to open a specific Kinect v2, if the SDK is ever updated to support multiple on one machine
            kinect   = KinectSensor.GetDefault();
            kinectID = kinectNumber;

            uint tempC = kinect.ColorFrameSource.FrameDescription.LengthInPixels;
            uint tempD = kinect.DepthFrameSource.FrameDescription.LengthInPixels;
            uint tempI = kinect.InfraredFrameSource.FrameDescription.LengthInPixels;

            colorImagePool = new KinectBase.ObjectPool <byte[]>(() => new byte[tempC * 4]);
            depthImagePool = new KinectBase.ObjectPool <byte[]>(() => new byte[tempD * 4]);
            irImagePool    = new KinectBase.ObjectPool <byte[]>(() => new byte[tempI * sizeof(UInt16)]);

            if (isGUILaunched)
            {
                isGUI = true;
                LaunchKinect();
            }
            else
            {
                launchKinectDelegate kinectDelegate = LaunchKinect;
                IAsyncResult         result         = kinectDelegate.BeginInvoke(null, null);
                kinectDelegate.EndInvoke(result);  //Even though this is blocking, the events should be on a different thread now.
            }
        }
        public void UpdateGUI(KinectBase.MasterSettings newSettings)
        {
            if (kinectID.HasValue)
            {
                masterSettings = newSettings;
                dynamic tempSettings = newSettings.kinectOptionsList[kinectID.Value];
                kinectSettings = (KinectV2Settings)tempSettings;

                //Update the color options
                useColorRadioButton.IsChecked = kinectSettings.useColorPreview;
                useIRRadionButton.IsChecked = kinectSettings.useIRPreview;

                //Update the depth options
                ScaleDepthCheckBox.IsChecked = kinectSettings.scaleDepthToReliableRange;
                ColorizeDepthCheckBox.IsChecked = kinectSettings.colorizeDepth;

                //Update skeleton options
                UseSkeletonCheckBox.IsChecked = kinectSettings.mergeSkeletons;
                UseRawSkeletonCheckBox.IsChecked = kinectSettings.sendRawSkeletons;
                XFormRawSkeletonCheckBox.IsChecked = kinectSettings.transformRawSkeletons;

                //Update audio settings
                SendSoundAngleCheckBox.IsChecked = kinectSettings.sendAudioAngle;
                audioServerTextBox.Text = kinectSettings.audioAngleServerName;
                audioChannelTextBox.Text = kinectSettings.audioAngleChannel.ToString();
                audioBeamSkeletonNumberTextBox.Text = kinectSettings.audioBeamTrackSkeletonNumber.ToString();
                switch (kinectSettings.audioTrackMode)
                {
                    //Note: the enabled/disabled controls don't need to be set manually here because the selected index changed event will still be hit
                    case KinectBase.AudioTrackingMode.Feedback:
                    {
                        audioBeamModeComboBox.SelectedIndex = 1;
                        break;
                    }
                    case KinectBase.AudioTrackingMode.MergedSkeletonX:
                    {
                        audioBeamModeComboBox.SelectedIndex = 2;
                        break;
                    }
                    case KinectBase.AudioTrackingMode.LocalSkeletonX:
                    {
                        audioBeamModeComboBox.SelectedIndex = 3;
                        break;
                    }
                    default:
                    {
                        audioBeamModeComboBox.SelectedIndex = 0;
                        break;
                    }
                }

                //Update the position options
                xPosTextBox.Text = kinectSettings.kinectPosition.X.ToString();
                yPosTextBox.Text = kinectSettings.kinectPosition.Y.ToString();
                zPosTextBox.Text = kinectSettings.kinectPosition.Z.ToString();
                yawPosTextBox.Text = kinectSettings.kinectYaw.ToString();
                pitchPosTextBox.Text = kinectSettings.kinectPitch.ToString();
                rollPosTextBox.Text = kinectSettings.kinectRoll.ToString();
            }
        }
Exemplo n.º 6
0
        public void UpdateGUI(KinectBase.MasterSettings newSettings)
        {
            if (kinectID.HasValue)
            {
                masterSettings = newSettings;
                dynamic tempSettings = newSettings.kinectOptionsList[kinectID.Value];
                kinectSettings = (KinectV2Settings)tempSettings;

                //Update the color options
                useColorRadioButton.IsChecked = kinectSettings.useColorPreview;
                useIRRadionButton.IsChecked   = kinectSettings.useIRPreview;

                //Update the depth options
                ScaleDepthCheckBox.IsChecked    = kinectSettings.scaleDepthToReliableRange;
                ColorizeDepthCheckBox.IsChecked = kinectSettings.colorizeDepth;

                //Update skeleton options
                UseSkeletonCheckBox.IsChecked      = kinectSettings.mergeSkeletons;
                UseRawSkeletonCheckBox.IsChecked   = kinectSettings.sendRawSkeletons;
                XFormRawSkeletonCheckBox.IsChecked = kinectSettings.transformRawSkeletons;

                //Update audio settings
                SendSoundAngleCheckBox.IsChecked    = kinectSettings.sendAudioAngle;
                audioServerTextBox.Text             = kinectSettings.audioAngleServerName;
                audioChannelTextBox.Text            = kinectSettings.audioAngleChannel.ToString();
                audioBeamSkeletonNumberTextBox.Text = kinectSettings.audioBeamTrackSkeletonNumber.ToString();
                switch (kinectSettings.audioTrackMode)
                {
                //Note: the enabled/disabled controls don't need to be set manually here because the selected index changed event will still be hit
                case KinectBase.AudioTrackingMode.Feedback:
                {
                    audioBeamModeComboBox.SelectedIndex = 1;
                    break;
                }

                case KinectBase.AudioTrackingMode.MergedSkeletonX:
                {
                    audioBeamModeComboBox.SelectedIndex = 2;
                    break;
                }

                case KinectBase.AudioTrackingMode.LocalSkeletonX:
                {
                    audioBeamModeComboBox.SelectedIndex = 3;
                    break;
                }

                default:
                {
                    audioBeamModeComboBox.SelectedIndex = 0;
                    break;
                }
                }

                //Update the position options
                xPosTextBox.Text     = kinectSettings.kinectPosition.X.ToString();
                yPosTextBox.Text     = kinectSettings.kinectPosition.Y.ToString();
                zPosTextBox.Text     = kinectSettings.kinectPosition.Z.ToString();
                yawPosTextBox.Text   = kinectSettings.kinectYaw.ToString();
                pitchPosTextBox.Text = kinectSettings.kinectPitch.ToString();
                rollPosTextBox.Text  = kinectSettings.kinectRoll.ToString();
            }
        }
Exemplo n.º 7
0
 //Needed for serialization
 public Settings()
 {
     realSettings = new KinectV2Settings();
 }
Exemplo n.º 8
0
 //Constructor to setup the real KinectV1Settings object
 public Settings(string uniqueID, int kinectNumber)
 {
     realSettings = new KinectV2Settings(uniqueID, kinectNumber);
 }