Esempio n. 1
0
        private void updateCammeraParameters()
        {
            CameraParameter cameraParameter = this.parameters.GetCameraParameter();

            if (this.xiAcquirer == null)
            {
                this.xiAcquirer = new XIAcquirer();
            }

            this.xiAcquirer.Open();

            object[] parameters = this.xiAcquirer.Get();

            this.xiAcquirer.Close();

            if ((parameters != null) && (parameters.Length > 0))
            {
                CameraParameter newCammeraParam = parameters[0] as CameraParameter;

                if (newCammeraParam != null)
                {
                    cameraParameter.DeviceInstancePath = newCammeraParam.DeviceInstancePath;
                    cameraParameter.DeviceName         = newCammeraParam.DeviceName;
                    cameraParameter.DeviceSN           = newCammeraParam.DeviceSN;
                    cameraParameter.DeviceType         = newCammeraParam.DeviceType;
                    cameraParameter.FrameRate          = newCammeraParam.FrameRate;
                    cameraParameter.AvailableBandWidth = newCammeraParam.AvailableBandWidth;
                    cameraParameter.OuputImageOffsetX  = newCammeraParam.OuputImageOffsetX;
                    cameraParameter.OutputImageOffsetY = newCammeraParam.OutputImageOffsetY;

                    this.propertyGridParameters.Refresh();
                }
            }
        }
Esempio n. 2
0
    void CalculateBackCamera()
    {
        Camera          camera = backCamera;
        CameraParameter param  = backCameraParam;

        param.farWidth  = w + wext + wext;
        param.nearWidth = w;
        param.farDis    = hext;

        CalCamera(param.farWidth, param.nearWidth, param.farDis,
                  ref param.disToEarth, ref param.fovV, ref param.fovH, ref param.ratio);
        param.texHeight = 256;
        param.texWidth  = param.texHeight * param.ratio;


        camera.transform.position = new Vector3(0, param.disToEarth, h / 2);
        camera.transform.rotation = Quaternion.EulerRotation(Mathf.PI / 2 - param.fovV / 2, 0, 0);
        camera.fieldOfView        = Mathf.Rad2Deg * param.fovV;
        CVRenderTexture rt = camera.GetComponent <CVRenderTexture>();

        if (rt)
        {
            rt.width  = (int)param.texWidth;
            rt.height = (int)param.texHeight;
        }
    }
 void Start()
 {
     originalRotate         = cameraRootTf.rotation;
     cameraDistance         = cameraTf.localPosition.z;
     targetCameraDistance   = cameraDistance;
     currentCameraParameter = freeOrbitParameter;
     isAlreadyFire          = new bool[yMinAngles.Length];
 }
Esempio n. 4
0
        private void ConnectBtnOnClick(object sender, EventArgs e)
        {
            try
            {
                int device_id = int.Parse(this._cameraCb.SelectedItem.ToString().Split(new char[] { '(', ')' })[1]);

                this._preset = CameraParameter.FromXml("cp.xml");

                CamView f = new CamView();

                episcan.InitializeSensor(f.Handle, device_id);
                episcan.ImageRoi = Roi;
                //Roi = episcan.ImageRoi;
                SetUIImageRoi();

                f.Sensor = episcan.Sensor;


                f.Show();

                f.Width  = (int)(0.5 * episcan.Sensor.Width);
                f.Height = (int)(0.5 * episcan.Sensor.Height);

                InitUIfromCamera();
                InitUI();

                //UpdateUIfromCamera();

                this._cameraGb.Enabled  = true;
                this._episcanGb.Enabled = true;

                // apply camera parameters
                try
                {
                    ApplyCameraParameters(this._preset);
                }
                catch (Exception)
                {
                }

                // update UI
                UpdateUIfromCamera();

                UpdateDelayExposure();

                UpdateDispString();

                episcan.Sensor.StartCapture();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
            public static CameraParameter FromXml(string path)
            {
                System.Xml.Serialization.XmlSerializer serializer =
                    new System.Xml.Serialization.XmlSerializer(typeof(CameraParameter));
                System.IO.StreamReader sr = new System.IO.StreamReader(path, new System.Text.UTF8Encoding(false));
                CameraParameter        cp = (CameraParameter)serializer.Deserialize(sr);

                //ファイルを閉じる
                sr.Close();

                return(cp);
            }
Esempio n. 6
0
 private void ApplyCameraParameters(CameraParameter param)
 {
     //this._sensor.Delay = param.Delay;
     this._sensor.DelayOffset     = param.DelayOffset;
     this._sensor.PixelClock      = param.PixelClock;
     this._sensor.Exposure        = param.Exposure;
     this._sensor.ShutterMode     = param.ShutterMode;
     this._sensor.TrigerMode      = param.TriggerMode;
     this._sensor.Width           = param.Width;
     this._sensor.Height          = param.Height;
     this._sensor.EnableGainBoost = param.EnableGainBoost;
     this._sensor.MasterGain      = param.MasterGain;
     this._sensor.Scaler          = param.Scaler;
     this._sensor.PixelFormat     = param.PixelFormat;
 }
Esempio n. 7
0
 private void ApplyCameraParameters_h(CameraParameter param)
 {
     //episcan.Sensor.Delay = param.Delay;
     subcam.Sensor_h.DelayOffset     = param.DelayOffset;
     subcam.Sensor_h.PixelClock      = param.PixelClock;
     subcam.Sensor_h.Exposure        = param.Exposure;
     subcam.Sensor_h.ShutterMode     = param.ShutterMode_h;
     subcam.Sensor_h.TrigerMode      = param.TriggerMode_h;
     subcam.Sensor_h.Width           = param.Width;
     subcam.Sensor_h.Height          = param.Height;
     subcam.Sensor_h.EnableGainBoost = param.EnableGainBoost;
     subcam.Sensor_h.MasterGain      = param.MasterGain;
     subcam.Sensor_h.Scaler          = param.Scaler;
     subcam.Sensor_h.PixelFormat     = param.PixelFormat_h;
 }
Esempio n. 8
0
        private void applyParameters()
        {
            NetworkParameter        networkParameter        = this.parameters.GetNetworkParameter();
            CameraParameter         cameraParameter         = this.parameters.GetCameraParameter();
            BarcodeImagingParameter barcodeImagingParameter = this.parameters.GetBarcodeImagingParameter();
            PersistencyParameter    persistencyParameter    = this.parameters.GetPersistencyParameter();

            MES.Processor.ModuleConfiguration.Default_BarCodeScanningTimes    = barcodeImagingParameter.ScanTimes;
            MES.Processor.ModuleConfiguration.Default_FailureRetryTimes       = barcodeImagingParameter.FailureRetryTimes;
            MES.Processor.ModuleConfiguration.IsExtractingBarCodes            = barcodeImagingParameter.IsExtractingBarCode;
            MES.Processor.ModuleConfiguration.IsCheckingSkewAngle             = barcodeImagingParameter.IsCheckingSkewAngle;
            MES.Processor.ModuleConfiguration.Default_ImageRotationDegree     = barcodeImagingParameter.ImageRotationDegree;
            MES.Processor.ModuleConfiguration.Default_ImageRotationParameters = new Dictionary <string, object>()
            {
                { "RotationAtPercentageOfImageWidth", barcodeImagingParameter.RotationAtPercentageOfImageWidth },
                { "RotationAtPercentageOfImageHeight", barcodeImagingParameter.RotationAtPercentageOfImageHeight },
                { "IsNoClip", barcodeImagingParameter.IsNoClip }
            };

            MES.Acquirer.ModuleConfiguration.Default_Timeout          = cameraParameter.DeviceTimeout;
            MES.Acquirer.ModuleConfiguration.Default_CameraParameters = new Dictionary <string, object>()
            {
                { "exposure", cameraParameter.Exposure },
                { "gain", cameraParameter.Gain },
                { "imgdataformat", cameraParameter.ImageDataFormat },
                { "downsampling_type", cameraParameter.DownSamplingType },
                { "downsampling", cameraParameter.DownSampling },
                { "height", cameraParameter.OutputImageHeight },
                { "width", cameraParameter.OuputImageWidth },
                { "sharpness", cameraParameter.Sharpness },
                { "gammaY", cameraParameter.GammaY },
                { "gammaC", cameraParameter.GammaC },
                { "exp_priority", cameraParameter.ExposurePriority },
                { "bpc", cameraParameter.EnableBPC ? 1 : 0 },
                { "auto_bandwidth_calculation", cameraParameter.EnableAutoBandWidthCalculation ? 1 : 0 },
                { "buffer_policy", cameraParameter.BufferPolicy },
                //{"limit_bandwidth", cameraParameter.LimitBandWidth}
                { "aeag", cameraParameter.EnableAEAG ? 1 : 0 },
                { "offsetX", cameraParameter.OuputImageOffsetX },
                { "offsetY", cameraParameter.OutputImageOffsetY }
            };

            MES.Acquirer.ModuleConfiguration.Default_ImageOuputFormat = cameraParameter.ImageOutputFormat;
        }
Esempio n. 9
0
 //カメラパラメータ変更(初期化なし)
 public void ChangeCameraParamater(CameraParameter parameter)
 {
     mainCameraParameter = parameter;
 }
Esempio n. 10
0
 //モード変更して必要なところを初期化(パラメータが変更されるとき使用)
 public void InitCameraParameterChange(CameraParameter parameter)
 {
     mainCameraParameter = parameter;
     nowCameraMode       = mainCameraParameter.CameraMode;
 }
        public Camera GetCameraParameters(string cameraName)
        {
            var    cameraDeviceInfoPtr = IntPtr.Zero;
            Camera camera = new Camera()
            {
                CameraParameters = new List <CameraParameter>()
            };

            try
            {
                var cameraInfoByte = Marshal.SizeOf(typeof(VideoDeviceInfo));

                cameraDeviceInfoPtr = Marshal.AllocHGlobal(cameraInfoByte);

                var result = MeetingAgent.GetCameraInfo(cameraName, cameraDeviceInfoPtr);

                var pointer = new IntPtr(cameraDeviceInfoPtr.ToInt64());

                var cameraInfo = (VideoDeviceInfo)Marshal.PtrToStructure(pointer, typeof(VideoDeviceInfo));

                camera.Name = cameraInfo.Name;
                for (int i = 0; i < cameraInfo.FormatCount; i++)
                {
                    VideoFormat videoFormat = cameraInfo.Formats[i];

                    CameraParameter cameraParameter = new CameraParameter()
                    {
                        ColorSpace = videoFormat.ColorSpace.ToString(),
                        Fps        = new List <int>(),
                        VideSizes  = new List <Size>()
                    };
                    for (int j = 0; j < videoFormat.sizeCount; j++)
                    {
                        VideoSize videoSize = videoFormat.VideoSizes[j];
                        cameraParameter.VideSizes.Add(new Size()
                        {
                            Width  = videoSize.Width,
                            Height = videoSize.Height
                        });
                    }

                    for (int k = 0; k < videoFormat.fpsCount; k++)
                    {
                        cameraParameter.Fps.Add(videoFormat.Fps[k]);
                    }

                    camera.CameraParameters.Add(cameraParameter);
                }
            }
            catch (Exception ex)
            {
                Log.Error($"GetCameraParameters({cameraName}) exception:{ex}");
            }
            finally
            {
                if (cameraDeviceInfoPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(cameraDeviceInfoPtr);
                }
            }

            return(camera);
        }
Esempio n. 12
0
        private void  HelperBtnOnClick(object sender, EventArgs e)
        {
            try
            {
                int device_id_sub = int.Parse(this._cameraCb.SelectedItem.ToString().Split(new char[] { '(', ')' })[1]);

                if (device_id_sub == 1)
                {
                    device_id_sub = 2;
                }
                else if (device_id_sub == 2)
                {
                    device_id_sub = 1;
                }


                this._preset_h = CameraParameter.FromXml("cp_sub.xml");

                CamView_h f_h = new CamView_h();

                subcam.InitializeSensor(f_h.Handle, device_id_sub);
                subcam.ImageRoi = Roi;
                //Roi = episcan.ImageRoi;
                //SetUIImageRoi();

                f_h.SubSensor = subcam.Sensor_h;


                f_h.Show();

                f_h.Width  = (int)(0.5 * subcam.Sensor_h.Width);
                f_h.Height = (int)(0.5 * subcam.Sensor_h.Height);

                // InitUIfromCamera();
                // InitUI();

                //UpdateUIfromCamera();

                this._cameraGb.Enabled  = true;
                this._episcanGb.Enabled = true;

                // apply camera parameters
                //try
                //{
                //    ApplyCameraParameters_h(this._preset_h);
                //}
                //catch (Exception)
                //{

                //}

                // update UI
                //UpdateUIfromCamera();

                //UpdateDelayExposure();

                //UpdateDispString();

                subcam.Sensor_h.StartCapture();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// Retrieves the <see cref="EffectParameter"/> which implements the specified built-in camera parameter,
 /// assuming this effect supports that parameter.
 /// </summary>
 /// <param name="parameter">A <see cref="CameraParameter"/> value for which to retrieve a corresponding effect parameter.</param>
 /// <returns>The <see cref="EffectParameter"/> that implements the specified built-in camera parameter,
 /// or <see langword="null"/> if the effect does not support that parameter.</returns>
 public EffectParameter GetCameraParameter(CameraParameter parameter)
 {
     return(builtInCameraParameters?[(Int32)parameter]);
 }
Esempio n. 14
0
        public void OnHandUpdate(CameraParameter cameraParam, SpatialCoordinateSystem CoordinateSystem, IList <Hand> hands)
        {
            lock (this)
            {
                if (m_spatialCoordinateSystem != null)
                {
                    //Start a new frame
                    foreach (HandDetected hand in m_handsDetected)
                    {
                        hand.NewDetection = true;
                    }

                    //For each detected hand
                    foreach (Hand hand in hands)
                    {
                        //Add offsets in the ROI
                        float[] roi = new float[4];
                        roi[0] = hand.WristROIMinX - 10;
                        roi[1] = hand.WristROIMinY - 10;
                        roi[2] = hand.WristROIMaxX + 10;
                        roi[3] = hand.WristROIMaxY + 10;

                        //check if we already know it
                        HandDetected handDetected = null;
                        foreach (HandDetected hd in m_handsDetected)
                        {
                            if (!hd.IsDetected && hd.HandCollision(roi))
                            {
                                handDetected = hd;
                                break;
                            }
                        }

                        //If not, this is a new hand!
                        if (handDetected == null)
                        {
                            handDetected = new HandDetected(m_smoothness);
                            handDetected.NewDetection = true;
                            m_handsDetected.Add(handDetected);
                        }

                        //Compute the hand 3D position in the left-handed coordinate system
                        System.Numerics.Matrix4x4?cameraToWorld = CoordinateSystem.TryGetTransformTo(m_spatialCoordinateSystem).Value;
                        System.Numerics.Matrix4x4 viewToCamera;
                        System.Numerics.Matrix4x4.Invert(cameraParam.CameraViewTransform, out viewToCamera);
                        if (cameraToWorld == null)
                        {
                            cameraToWorld = System.Numerics.Matrix4x4.Identity;
                        }

                        System.Numerics.Vector4 handVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(hand.PalmX, hand.PalmY, hand.PalmZ, 1.0f), viewToCamera);
                        handVec = System.Numerics.Vector4.Transform(handVec, cameraToWorld.Value);
                        Vector3 unityHandVec = new Vector3(handVec.X, handVec.Y, -handVec.Z) / handVec.W;

                        System.Numerics.Vector4 wristVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(hand.WristX, hand.WristY, hand.WristZ, 1.0f), viewToCamera);
                        wristVec = System.Numerics.Vector4.Transform(wristVec, cameraToWorld.Value);
                        Vector3 unityWristVec = new Vector3(wristVec.X, wristVec.Y, -wristVec.Z) / wristVec.W;

                        handDetected.PushPosition(unityHandVec, unityWristVec, roi);

                        //Clear fingers information
                        handDetected.Fingers.Clear();
                        handDetected.UppestFinger = null;

                        FingerDetected formerFinger = handDetected.UppestFinger;

                        if (hand.Fingers.Count > 0)
                        {
                            //Conver each fingers detected
                            foreach (Finger f in hand.Fingers)
                            {
                                //Register the finger position
                                System.Numerics.Vector4 fingerVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(f.TipX, f.TipY, f.TipZ, 1.0f), viewToCamera);
                                fingerVec = System.Numerics.Vector4.Transform(fingerVec, cameraToWorld.Value);
                                Vector3 unityFingerVec = new Vector3(fingerVec.X, fingerVec.Y, -fingerVec.Z) / fingerVec.W;
                                handDetected.Fingers.Add(new FingerDetected(unityFingerVec));
                            }

                            //Detect the uppest finger
                            float minFY = hand.Fingers[0].TipY;
                            handDetected.UppestFinger = handDetected.Fingers[0];

                            for (int i = 1; i < handDetected.Fingers.Count; i++)
                            {
                                if (minFY > hand.Fingers[0].TipY)
                                {
                                    minFY = hand.Fingers[0].TipY;
                                    handDetected.UppestFinger = handDetected.Fingers[i];
                                }
                            }

                            //Apply smoothness on this particular finger
                            if (formerFinger != null)
                            {
                                handDetected.UppestFinger.Position = (1.0f - m_smoothness) * handDetected.UppestFinger.Position + m_smoothness * formerFinger.Position;
                            }
                        }
                    }
                }

                for (int i = 0; i < m_handsDetected.Count; i++)
                {
                    HandDetected hd = m_handsDetected[i];
                    //Handle non detected hands
                    if (!hd.IsDetected)
                    {
                        hd.PushUndetection();

                        //Delete the non valid hands
                        if (!hd.IsValid)
                        {
                            m_handsDetected.RemoveAt(i);
                            i--;
                            continue;
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        private void RefreshResolutionsAsync(ConfigChangedItem configChangedItem)
        {
            if (configChangedItem.value == NonExclusiveItem)
            {
                return;
            }

            Camera videoDeviceInfo = _sdkService.GetCameraInfo(configChangedItem.value);


            if (configChangedItem.key == ConfigItemKey.MainCamera)
            {
                if (videoDeviceInfo.CameraParameters.Count > 0)
                {
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Clear();

                    CameraParameter cameraParameter = videoDeviceInfo.CameraParameters[0];

                    foreach (Size t in cameraParameter.VideoSizes)
                    {
                        string resolution = $"{t.Width}*{t.Height}";

                        if (!MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.UserCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution))
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution;
                }
                else if (MeetingConfigParameter.UserCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        MeetingConfigParameter.UserCameraSetting.ResolutionList[0];
                }
            }

            if (configChangedItem.key == ConfigItemKey.SecondaryCamera)
            {
                if (videoDeviceInfo.CameraParameters.Count > 0)
                {
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Clear();

                    CameraParameter cameraParameter = videoDeviceInfo.CameraParameters[0];

                    foreach (Size t in cameraParameter.VideoSizes)
                    {
                        string resolution = $"{t.Width}*{t.Height}";

                        if (!MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.DataCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution))
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution;
                }
                else if (MeetingConfigParameter.DataCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        MeetingConfigParameter.DataCameraSetting.ResolutionList[0];
                }
            }
        }
Esempio n. 16
0
        public void OnHandUpdate(CameraParameter cameraParam, SpatialCoordinateSystem CoordinateSystem, IList <Hand> hands)
        {
            lock (this)
            {
                if (m_spatialCoordinateSystem != null)
                {
                    //Start a new frame
                    foreach (HandDetected hand in m_handsDetected)
                    {
                        hand.NewDetection = true;
                    }

                    //For each detected hand
                    foreach (Hand hand in hands)
                    {
                        //Get the needed transformation matrices to convert hand in image space to camera and world space
                        System.Numerics.Matrix4x4?cameraToWorld = CoordinateSystem.TryGetTransformTo(m_spatialCoordinateSystem).Value;
                        System.Numerics.Matrix4x4 viewToCamera;
                        System.Numerics.Matrix4x4.Invert(cameraParam.CameraViewTransform, out viewToCamera);
                        if (cameraToWorld == null)
                        {
                            cameraToWorld = System.Numerics.Matrix4x4.Identity;
                        }

                        //Hand in camera space
                        System.Numerics.Vector4 handVecCamera = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(hand.PalmX, hand.PalmY, hand.PalmZ, 1.0f), viewToCamera);
                        Vector3 unityHandCamera = new Vector3(handVecCamera.X, handVecCamera.Y, handVecCamera.Z) / handVecCamera.W;

                        //Wrist in camera space
                        System.Numerics.Vector4 wristVecCamera = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(hand.WristX, hand.WristY, hand.WristZ, 1.0f), viewToCamera);
                        Vector3 unityWristCamera = new Vector3(wristVecCamera.X, wristVecCamera.Y, wristVecCamera.Z) / wristVecCamera.W;

                        //Add offsets in the ROI
                        float[] roi = new float[4];
                        roi[0] = hand.WristROIMinX - 10;
                        roi[1] = hand.WristROIMinY - 10;
                        roi[2] = hand.WristROIMaxX + 10;
                        roi[3] = hand.WristROIMaxY + 10;

                        //check if we already know it
                        bool         created      = false;
                        HandDetected handDetected = null;
                        foreach (HandDetected hd in m_handsDetected)
                        {
                            if (!hd.IsDetected && hd.HandCollision(roi) && (hd.CameraSpacePosition - unityHandCamera).magnitude <= 0.10) //Test the ROI and the magnitude in the position (no more than 5 cm)
                            {
                                handDetected = hd;
                                break;
                            }
                        }

                        //If not, this is a new hand!
                        if (handDetected == null)
                        {
                            handDetected = new HandDetected();
                            handDetected.NewDetection = true;
                            m_handsDetected.Add(handDetected);
                            created = true;
                        }

                        float smoothness = m_smoothness;
                        if (created == true)
                        {
                            smoothness = 0.0f;
                        }

                        //Smooth the hand
                        Vector3 smoothPosCamera         = unityHandCamera * (1.0f - smoothness) + handDetected.CameraSpacePosition * smoothness; //Smooth the position
                        System.Numerics.Vector4 handVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(smoothPosCamera.x, smoothPosCamera.y, smoothPosCamera.z, 1.0f), cameraToWorld.Value);
                        Vector3 unityHandVec            = new Vector3(handVec.X, handVec.Y, -handVec.Z) / handVec.W;

                        //Smooth the wrist
                        Vector3 smoothWristCamera        = unityWristCamera * (1.0f - smoothness) + handDetected.CameraSpaceWristPosition * smoothness; //Smooth the position
                        System.Numerics.Vector4 wristVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(smoothWristCamera.x, smoothWristCamera.y, smoothWristCamera.z, 1.0f), cameraToWorld.Value);
                        Vector3 unityWristVec            = new Vector3(wristVec.X, wristVec.Y, -wristVec.Z) / wristVec.W;

                        handDetected.PushPosition(unityHandVec, unityWristVec, smoothPosCamera, smoothWristCamera, roi);

                        //Clear fingers information
                        handDetected.Fingers.Clear();
                        handDetected.UppestFinger = null;

                        FingerDetected formerFinger = handDetected.UppestFinger;

                        if (hand.Fingers.Count > 0)
                        {
                            //Conver each fingers detected
                            foreach (Finger f in hand.Fingers)
                            {
                                //Register the finger position
                                System.Numerics.Vector4 fingerVec = System.Numerics.Vector4.Transform(new System.Numerics.Vector4(f.TipX, f.TipY, f.TipZ, 1.0f), viewToCamera);
                                fingerVec = System.Numerics.Vector4.Transform(fingerVec, cameraToWorld.Value);
                                Vector3 unityFingerVec = new Vector3(fingerVec.X, fingerVec.Y, -fingerVec.Z) / fingerVec.W;
                                handDetected.Fingers.Add(new FingerDetected(unityFingerVec));
                            }

                            //Detect the uppest finger
                            float minFY = hand.Fingers[0].TipY;
                            handDetected.UppestFinger = handDetected.Fingers[0];

                            for (int j = 1; j < handDetected.Fingers.Count; j++)
                            {
                                if (minFY > hand.Fingers[0].TipY)
                                {
                                    minFY = hand.Fingers[0].TipY;
                                    handDetected.UppestFinger = handDetected.Fingers[j];
                                }
                            }
                        }
                    }
                }

                int i = 0;
                while (i < m_handsDetected.Count)
                {
                    HandDetected hd = m_handsDetected[i];
                    //Handle non detected hands
                    if (!hd.IsDetected)
                    {
                        hd.PushUndetection();

                        //Delete the non valid hands
                        if (!hd.IsValid)
                        {
                            m_handsDetected.RemoveAt(i);
                            continue;
                        }
                    }
                    i++;
                }
            }
        }