Answers to: Matlab Supporthttp://answers.eyetechds.com/questions/15/matlab-support<p>What Matlab support is available with QuickLINK 2?</p>enTue, 31 Mar 2015 17:41:18 -0400Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#313<p>You are correct. Buffering it yourself is the only way to do it with QL2. I may move this to be its own separate question on the site. Thanks again for your help on the Matlab wrapper.</p>phyattTue, 31 Mar 2015 17:41:18 -0400http://answers.eyetechds.com/questions/15/matlab-support#313Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#312<p>Wrapper dll updated and example code added.</p>phyattTue, 31 Mar 2015 17:35:47 -0400http://answers.eyetechds.com/questions/15/matlab-support#312Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#311<p>I haven't implemented this one yet, but it is important to have. I'll work on it shortly.</p>phyattTue, 31 Mar 2015 15:02:03 -0400http://answers.eyetechds.com/questions/15/matlab-support#311Comment by Vk9d on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#310<p>To answer my own question: i guess a Matlab timer object can be used to fire QL2MW_GetFrame perdiodically.</p>Vk9dTue, 31 Mar 2015 11:03:43 -0400http://answers.eyetechds.com/questions/15/matlab-support#310Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/309<p>One more question: coming from QL1 there used to be a function 'StartBulkCapture'. How do I perform an asynchronous frameData capture in Matlab with QL2? </p>Vk9dTue, 31 Mar 2015 10:59:56 -0400http://answers.eyetechds.com/questions/15/matlab-support/309Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/308<p>Thank you for the update again. The example works. Could not find any description of other functions though. What are the parameters to use 'QL2MW_GetCalibrationScoring'?</p>Vk9dTue, 31 Mar 2015 10:42:32 -0400http://answers.eyetechds.com/questions/15/matlab-support/308Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#307<p>And done! See the updates on the project. It looks good and runs well.</p>phyattMon, 30 Mar 2015 19:23:18 -0400http://answers.eyetechds.com/questions/15/matlab-support#307Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/306<p>Thanks, phyatt!
The example works and loads the library (under x64). The get-frame functions still need work and a good example to be usable to me.
I guess a wrapper is a more elegant way than wrapping it all in matlab (or writing a mex file). Keep up the good work, awaiting the results anxiously!</p>Vk9dMon, 30 Mar 2015 09:45:14 -0400http://answers.eyetechds.com/questions/15/matlab-support/306Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#305<p>see my update to the original answer.</p>phyattFri, 27 Mar 2015 20:29:33 -0400http://answers.eyetechds.com/questions/15/matlab-support#305Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#304<p>see my update to the original answer.</p>phyattFri, 27 Mar 2015 20:29:23 -0400http://answers.eyetechds.com/questions/15/matlab-support#304Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#303<p>The MatlabWrapper is supposed to help with almost all of the array access. I almost have it built... otherwise you have to use the bit packing mentioned in <code>C:\Program Files\EyeTechDS\QuickLINK_2_2.6.3.1\doc\QLFrameData Byte Alignment Guide 2.5.0.0.pdf</code> to manually specify which bits map to and from the data structure. The <code>libpointer</code> call may be helping with that, but I'm not sure... I am getting closer to having an example ready.</p>phyattFri, 27 Mar 2015 17:42:43 -0400http://answers.eyetechds.com/questions/15/matlab-support#303Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/302<p>The bottomline is that the args are not unpacking right. It is a black box to me so I don't know where to look. I managed to invoke other quicklink2.dll funcs, but not this one.</p>Vk9dFri, 27 Mar 2015 13:35:42 -0400http://answers.eyetechds.com/questions/15/matlab-support/302Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/301<p><code>loadlibrary(fullfile(QGPATH, 'QuickLink2.dll'), fullfile(QGPATH, '\..\..\QuickLINK_2_2.6.3.1\include\QuickLink2.h'), 'addheader', 'QLTypes, windows', 'includepath', fullfile(QGPATH, '\..\..\QuickLINK_2_2.6.3.1\include\'), 'mfilename', 'QuickLink2.m');
frameP = libstruct('QLFrameData');
frameP.ImageData = libstruct('QLImageData');
frameP.ImageData.ROI = libstruct('QLRectInt');
frameP.LeftEye = libstruct('QLEyeData');
frameP.LeftEye.Pupil = libstruct('QLXYPairFloat');
frameP.LeftEye.Glint0 = libstruct('QLXYPairFloat');
frameP.LeftEye.Glint1 = libstruct('QLXYPairFloat');
frameP.LeftEye.GazePoint = libstruct('QLXYPairFloat');
frameP.RightEye = libstruct('QLEyeData');
frameP.RightEye.Pupil = libstruct('QLXYPairFloat');
frameP.RightEye.Glint0 = libstruct('QLXYPairFloat');
frameP.RightEye.Glint1 = libstruct('QLXYPairFloat');
frameP.RightEye.GazePoint = libstruct('QLXYPairFloat');
frameP.WeightedGazePoint = libstruct('QLWeightedGazePoint');
frameP.ImageData.PixelData = libpointer('uint8Ptr');
frameP.ImageData.Reserved = libpointer('voidPtr');
frameP.LeftEye.Reserved = libpointer('voidPtr');
frameP.RightEye.Reserved = libpointer('voidPtr');
frameP.WeightedGazePoint.Reserved = libpointer('voidPtr');
frameP.Reserved = libpointer('voidPtr');
frameP.Focus = 0; % init at least one field
[success, frameP] = calllib('QuickLink2', 'QLDevice_GetFrame', deviceID, waitTime, frameP);</code></p>Vk9dFri, 27 Mar 2015 13:32:05 -0400http://answers.eyetechds.com/questions/15/matlab-support/301Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#300<p>Can you post all the Matlab QuickLink2 calls? It may be easier to find the bug with some more code. I'll see if I can get a better sample ready.</p>phyattThu, 26 Mar 2015 12:04:43 -0400http://answers.eyetechds.com/questions/15/matlab-support#300Comment by Vk9d on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#297<p>phyatt, thanks for your response. I figured out the calibration call. Now struggling with getting the frame data. It does look like matlab can handle nested structs by I have a memory access violation somewhere when passing arguments in the call that crashes the matlab. Code below:</p>
<p>frameP = libstruct('QLFrameData');
frameP.ImageData = libstruct('QLImageData');
% same initialization for all other structs inside the QLFrameData
%......</p>
<pre><code>[success, frameP] = calllib('QuickLink2', 'QLDevice_GetFrame', deviceID, waitTime, frameP);
</code></pre>Vk9dThu, 26 Mar 2015 09:04:40 -0400http://answers.eyetechds.com/questions/15/matlab-support#297Comment by phyatt on Vk9d's answerhttp://answers.eyetechds.com/questions/15/matlab-support#296<p>Hi <a href="/users/6833/vk9d">@Vk9d</a>, The Matlab wrapper hasn't been updated for a while, and it looks like it didn't include the struct mapping for calibration target objects... I just spent some time looking through it. I would make the array similar to how some of the other structs are made in <code>QL2StructToMxArray.cpp</code>. The maximum number of points is 16. I'll see if I can get an update done in the next week or so. The easiest use case would be to use <code>QLCalibration_LoadCalibration</code> and <code>QLDevice_ApplyCalibration</code>, using a calibration that was saved by QuickACCESS or QuickGLANCE.</p>phyattTue, 24 Mar 2015 18:47:05 -0400http://answers.eyetechds.com/questions/15/matlab-support#296Answer by Vk9dhttp://answers.eyetechds.com/questions/15/matlab-support/294<p>I have seen the wrapper. What about the actual matlab sample use code? I am struggling passing the array pointers in QLCalibration_GetTargets.</p>Vk9dTue, 24 Mar 2015 15:26:30 -0400http://answers.eyetechds.com/questions/15/matlab-support/294Answer by anonymous2http://answers.eyetechds.com/questions/15/matlab-support/16<p>UPDATE:</p>
<p>Gitlab version of wrapper with example code! Very well supported with great example code.</p>
<p><img alt="alt text" src="https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper/raw/master/examples/live_view_screenshot.jpg"></p>
<p><img alt="alt text" src="https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper/raw/master/examples/score_screenshot.jpg"></p>
<p><img alt="alt text" src="https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper/raw/master/examples/gaze_point_screenshot.jpg"></p>
<p><a href="https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper">https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper</a></p>
<p><a href="https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper/tree/master">README.md</a></p>
<p><strike>
It is a visual studio 2010 project. It may need some updating, but it has worked in the past.</strike></p><strike>
</strike><p><strike><a href="http://office.eyetechds.com/downloads/QL2MatlabWrapperSample.zip">http://office.eyetechds.com/downloads/QL2MatlabWrapperSample.zip</a>
</strike></p>
<p>If you are interested in just getting the data from a single study into Matlab, see this question:</p>
<p><a href="http://answers.eyetechds.com/questions/7/ascii-matlab-eye-tracking-output">ASCII Matlab Eye Tracking Output</a></p>anonymous2Wed, 19 Feb 2014 12:12:59 -0500http://answers.eyetechds.com/questions/15/matlab-support/16