​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

What Matlab support is available with QuickLINK 2?

asked 19 Feb '14, 12:07

anonymous2's gravatar image

anonymous2
(suspended)
accept rate: 100%


UPDATE:

Gitlab version of wrapper with example code! Very well supported with great example code.

alt text

alt text

alt text

https://gitlab.eyetechds.com/windows_public/ql2-matlab-wrapper

README.md

It is a visual studio 2010 project. It may need some updating, but it has worked in the past.

http://office.eyetechds.com/downloads/QL2MatlabWrapperSample.zip

If you are interested in just getting the data from a single study into Matlab, see this question:

ASCII Matlab Eye Tracking Output

link

answered 19 Feb '14, 12:12

anonymous2's gravatar image

anonymous2
(suspended)
accept rate: 100%

edited 31 Mar '15, 16:50

phyatt's gravatar image

phyatt ♦♦
15791954

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?

link

answered 31 Mar '15, 10:59

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

To answer my own question: i guess a Matlab timer object can be used to fire QL2MW_GetFrame perdiodically.

(31 Mar '15, 11:03) Vk9d

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.

(31 Mar '15, 17:41) phyatt ♦♦

I have seen the wrapper. What about the actual matlab sample use code? I am struggling passing the array pointers in QLCalibration_GetTargets.

link

answered 24 Mar '15, 15:26

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

Hi @Vk9d, 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 QL2StructToMxArray.cpp. 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 QLCalibration_LoadCalibration and QLDevice_ApplyCalibration, using a calibration that was saved by QuickACCESS or QuickGLANCE.

(24 Mar '15, 18:47) phyatt ♦♦

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:

frameP = libstruct('QLFrameData'); frameP.ImageData = libstruct('QLImageData'); % same initialization for all other structs inside the QLFrameData %......

[success, frameP] = calllib('QuickLink2', 'QLDevice_GetFrame', deviceID, waitTime, frameP);
(26 Mar '15, 09:04) Vk9d

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.

(26 Mar '15, 12:04) phyatt ♦♦

see my update to the original answer.

(27 Mar '15, 20:29) phyatt ♦♦

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);

link

answered 27 Mar '15, 13:32

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

edited 27 Mar '15, 13:33

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.

link

answered 27 Mar '15, 13:35

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

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 C:\Program Files\EyeTechDS\QuickLINK_2_2.6.3.1\doc\QLFrameData Byte Alignment Guide 2.5.0.0.pdf to manually specify which bits map to and from the data structure. The libpointer call may be helping with that, but I'm not sure... I am getting closer to having an example ready.

(27 Mar '15, 17:42) phyatt ♦♦

see my update to the original answer.

(27 Mar '15, 20:29) phyatt ♦♦

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!

link

answered 30 Mar '15, 09:45

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

And done! See the updates on the project. It looks good and runs well.

(30 Mar '15, 19:23) phyatt ♦♦

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'?

link

answered 31 Mar '15, 10:42

Vk9d's gravatar image

Vk9d
612
accept rate: 0%

I haven't implemented this one yet, but it is important to have. I'll work on it shortly.

(31 Mar '15, 15:02) phyatt ♦♦

Wrapper dll updated and example code added.

(31 Mar '15, 17:35) phyatt ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×2

Asked: 19 Feb '14, 12:07

Seen: 3,363 times

Last updated: 31 Mar '15, 17:41

Copyright © 2014-2017 EyeTech Digital Systems Inc. All rights reserved. | About | FAQ | Privacy | Support | Contact | Powered by BitNami OSQA