how to plot x y over time
조회 수: 4 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Yash
2024년 10월 4일
Hi @Korrawit
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!