how to plot x y over time

4 Ansichten (letzte 30 Tage)
Korrawit
Korrawit am 2 Okt. 2024
Beantwortet: Yash am 4 Okt. 2024
this is te first time i used MATLAB i have eyetrack record like this
eyetrackRecord =
struct with fields:
x: [1.3756e+03 1.3734e+03 1.3798e+03 1.3789e+03 … ] (1×5128 double)
y: [416.1000 415.5000 416.6000 410.8000 … ] (1×5128 double)
pa: [1416 1423 1423 1421 1420 1424 1431 1417 … ] (1×5128 double)
t: [281349 281395 281403 281409 281418 281423 … ] (1×5128 double)
missing: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 … ] (1×5128 double)
How can I plot the moving heatmap of gazing over the video file in MATLAB

Antworten (1)

Yash
Yash am 4 Okt. 2024
Since you have the "eyetrackRecord" data variable, you can ustilise the hist3 function to get the heatmap.
numBins = [100, 100];
% Sample data
numPoints = 5000; frameWidth = 1920; frameHeight = 1080;
x = frameWidth * rand(1, numPoints);
y = frameHeight * rand(1, numPoints);
% Create a 2D histogram of the gaze data
heatmapData = hist3([y', x'], 'Nbins', numBins);
% Normalize
heatmapData = heatmapData / max(heatmapData(:));
% Display the heatmap
figure;
imagesc(heatmapData);
colormap('jet'); % Use a colormap to represent the heat values
colorbar;
title('Gaze Heatmap'); xlabel('Horizontal Position'); ylabel('Vertical Position');
axis equal;
set(gca, 'YDir', 'normal'); % Flip the Y-axis to match the image coordinates
I hope this helps!

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by