%This function is used for mapping the fixation record into the corresponding fixation maps.
screen_res_x = 1440;
screen_res_y = 900;
parent_dir = 'GIVE PATH TO PARENT DIRECTORY';
datasetFile1 = 'movie';
datasetFile = 'video';
gazeFile = 'exportdata_train';
videoFiles = dir(fullfile('./', datasetFile));
videoNUM = length(videoFiles)-2;
rate = 30;
full_vid_dir = [parent_dir, datasetFile, '/'];
for videonum = 1:700
videofolder = videoFiles(videonum+2).name
vidObj = VideoReader([full_vid_dir,videofolder]);
options.infolder = fullfile( './', datasetFile, videofolder, 'images' );
% no need to read full video if I can use VideoReader to know
% dimensions and duration of video
% Cache all frames in memory
%[data.frames,names,video_res_y,video_res_x,nframe ]= readAllFrames( options );
nframe = vidObj.NumberOfFrames;
video_res_x = vidObj.Width;
video_res_y = vidObj.Height;
a=video_res_x/screen_res_x;
b=(screen_res_y-video_res_y/a)/2;
all_fixation = zeros(video_res_y,video_res_x,nframe);
for person = 1:17
%modified the following line to match the video naming format
txtloc = fullfile(parent_dir, gazeFile, sprintf('P%02d',person), [sprintf('P%02d_Trail',person), sprintf('%03d.txt',videonum)]);
if exist(txtloc, 'file')
%modified the following line to match the txt file format
[time,model,trialnum,diax, diay, x_screen,y_screen,event]=textread(txtloc,'%f%s%f%f%f%f%f%s','headerlines',1);
if size(time,1)
time = time-time(1);
event = cellfun(@(x) x(1), event);
for index = 1:nframe
eff = find( ((index-1)<rate*time/1000000)&(rate*time/1000000<index)&event=='F'); %framerate = 10;
x_stimulus=int32(a*x_screen(eff));
y_stimulus=int32(a*(y_screen(eff)-b));
t = x_stimulus<=0|x_stimulus>=video_res_x|y_stimulus<=0|y_stimulus>=video_res_y;
all_fixation(y_stimulus(~t),x_stimulus(~t),index) = 1;
end
end
end
end
end
Hi, thanks for the nice dataset.
I want to recreate the fixation maps using the raw gaze records in exportdata_train folder released for DHF1K.
However, the fixation map obtained using record_mapping.m script and raw data from exportdata_train folder donot match the ones released in DHF1K.
For example:
I used the record_mapping.m file after specifying appropriate paths and modifying line 22 and line 24.
Could you please help me understand what I might be missing?
For your reference, here is my copy of record_mapping.m file: