Jump to content

Asish

Verified Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by Asish

  1. Dear All,

    I'm trying to calculate distance between gaze_origin(provided by API) and the target object using following code but the units are not same for these two points. So, how to get same type of coordinate system? 

    var d = GameObject.Find("CubeObject").transform.position;

     var combine_gaze = eyeData.verbose_data.combined.eye_data.gaze_origin_mm;

     float dist = Vector3.Distance(d, combine_gaze);

     

    Thanks in advance

  2. Hello guys,

    I'm trying to calculate distance between gaze_origin(provided by API) and the target object using following code but the units are not same for these two points. So, how to get same type of coordinate system? 

    var d = GameObject.Find("CubeObject").transform.position;

     var combine_gaze = eyeData.verbose_data.combined.eye_data.gaze_origin_mm;

     float dist = Vector3.Distance(d, combine_gaze);

     

    Thanks in advance

  3. Hello @Corvus @HackPerception

    I'm trying to calculate distance between gaze_origin(provided by API) and the target object using following code but the units are not same for these two points. So, how to get same type of coordinate system? 

    var d = GameObject.Find("CubeObject").transform.position;

     var combine_gaze = eyeData.verbose_data.combined.eye_data.gaze_origin_mm;

     float dist = Vector3.Distance(d, combine_gaze);

     

    Thanks in advance

  4. @Corvus @Tony PH Lin why timestamp feature is more important than other features like eye_diameter, eye_openness, eye_wideness? I used SRanipal 1.1.0.1. 

    and chi square feature selection techniques to understand the important feature and it shows timestamp is more important. I need to understand why timestamp is more important.

    I also found that timestamp has negative values but I don't know why. Could you please clarify it? 

     

  5. Hello @Corvus, @VibrantNebula

    I created project and imported VIVE SR(SRanipal sdk 1.1.0.1) but   EyeSample_v2 does not run in unity 2017.4. When I run it, simply crashed unity and shut down.

    Log file shows Unknown caused an Access Violation (0xc0000005)
      in module Unknown at 0033:10740380.

    Also I tried with unity version 2018.2 and 2018.3 but sample project does not run on it.

    Any suggestions?

  6. @Daniel_Y, Link  does not exist from previous post. Here is a similar question about gaze origin, https://community.viveport.com/t5/Vive-SRanipal-SDK/Vive-Pro-Eye-Finding-a-single-eye-origin-in-world-space/gpm-p/31592#M20.The diagram is updated. The gaze origin is with repect to System Origin.

    @iuilab, Did you get your answer? If so, Please let me know about gaze_origin_mm  interms or left and right eye. If I take average of these two points, then does it mean the position of the object in the scene where user looked at? 

     

    Thanks

  7. Hello @Corvus, Thanks for your clarification. 

    I recorded data by "Enable Eye Data Callback" and version 2. I modified the following code and recorded data. I got around 15k row for 70 seconds but it's supposed to record 8k (70 sec * 120 FPS = 8400 rows) row as output frequency is 120hz. Could you please tell me what's wrong with this?  

     

     

     public class SRanipal_GazeRaySample_v2 : MonoBehaviour
                {
                    public int LengthOfRay = 25;
                    [SerializeField] private LineRenderer GazeRayRenderer;
                    private static EyeData_v2 eyeData = new EyeData_v2();
                    private bool eye_callback_registered = false;

                    private StringBuilder csv;
                    string strFilePath = @"D:\Unity_workspace\eye_tracking2020\Tutorial4\Assets\Data.csv";
                    string strSeperator = ",";
                    static StringBuilder sbOutput = new StringBuilder();

                    private void Start()
                    {
                        sbOutput = new StringBuilder();
                        if (!SRanipal_Eye_Framework.Instance.EnableEye)
                        {
                            enabled = false;
                            return;
                        }
                        Assert.IsNotNull(GazeRayRenderer);
                    }

                    private void Update()
                    {

                        if (Input.GetKey("up"))
                        {
                            startRecord();
                        }

                        if (Input.GetKey("down"))
                        {
                            stopRecord();
                        }
                    }
                    private void Release()
                    {
                        if (eye_callback_registered == true)
                        {
                            SRanipal_Eye_v2.WrapperUnRegisterEyeDataCallback(Marshal.GetFunctionPointerForDelegate((SRanipal_Eye_v2.CallbackBasic)EyeCallback));
                            eye_callback_registered = false;
                        }

                       
                    }

                    private void stopRecord()
                    {
                        File.WriteAllText(strFilePath, sbOutput.ToString());
                        File.AppendAllText(strFilePath, sbOutput.ToString());
                    }

                    private void startRecord()
                    {
                        if (SRanipal_Eye_Framework.Status != SRanipal_Eye_Framework.FrameworkStatus.WORKING &&
                         SRanipal_Eye_Framework.Status != SRanipal_Eye_Framework.FrameworkStatus.NOT_SUPPORT) return;

                        if (SRanipal_Eye_Framework.Instance.EnableEyeDataCallback == true && eye_callback_registered == false)
                        {
                            SRanipal_Eye_v2.WrapperRegisterEyeDataCallback(Marshal.GetFunctionPointerForDelegate((SRanipal_Eye_v2.CallbackBasic)EyeCallback));
                            eye_callback_registered = true;
                        }
                        else if (SRanipal_Eye_Framework.Instance.EnableEyeDataCallback == false && eye_callback_registered == true)
                        {
                            SRanipal_Eye_v2.WrapperUnRegisterEyeDataCallback(Marshal.GetFunctionPointerForDelegate((SRanipal_Eye_v2.CallbackBasic)EyeCallback));
                            eye_callback_registered = false;
                        }

                        Vector3 GazeOriginCombinedLocal, GazeDirectionCombinedLocal;

                        if (eye_callback_registered)
                        {
                            if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.COMBINE, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal, eyeData)) { }
                            else if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.LEFT, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal, eyeData)) { }
                            else if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.RIGHT, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal, eyeData)) { }
                            else return;
                        }
                        else
                        {
                            if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.COMBINE, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal)) { }
                            else if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.LEFT, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal)) { }
                            else if (SRanipal_Eye_v2.GetGazeRay(GazeIndex.RIGHT, out GazeOriginCombinedLocal, out GazeDirectionCombinedLocal)) { }
                            else return;
                        }

                        Vector3 GazeDirectionCombined = Camera.main.transform.TransformDirection(GazeDirectionCombinedLocal);
                        GazeRayRenderer.SetPosition(0, Camera.main.transform.position - Camera.main.transform.up * 0.05f);
                        GazeRayRenderer.SetPosition(1, Camera.main.transform.position + GazeDirectionCombined * LengthOfRay);

                    }
                    private static void EyeCallback(ref EyeData_v2 eye_data)
                    {
                        eyeData = eye_data;

                        var L_dia = eyeData.verbose_data.left.pupil_diameter_mm;
                        var l_openness = eyeData.verbose_data.left.eye_openness;
                        var l_gaze_origin = eyeData.verbose_data.left.gaze_origin_mm;
                        var l_gaze_dir_norm = eyeData.verbose_data.left.gaze_direction_normalized;
                        var l_pupil_pos = eyeData.verbose_data.left.pupil_position_in_sensor_area;
                      

                        var R_dia = eyeData.verbose_data.right.pupil_diameter_mm;
                        var R_openness = eyeData.verbose_data.right.eye_openness;
                        var R_gaze_origin = eyeData.verbose_data.right.gaze_origin_mm;
                        var R_gaze_dir_norm = eyeData.verbose_data.right.gaze_direction_normalized;
                        var R_pupil_pos = eyeData.verbose_data.right.pupil_position_in_sensor_area;

                        var newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", L_dia, l_openness, l_gaze_origin, l_gaze_dir_norm, l_pupil_pos, R_dia, R_openness, R_gaze_origin, R_gaze_dir_norm, R_pupil_pos);

                        sbOutput.AppendLine(newLine);
                        


                    }
                }

     

×
×
  • Create New...