Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fixed heatmaps
- Loading branch information
john.wohl@uconn.edu
committed
Apr 12, 2020
1 parent
ffb4890
commit 7c96e3f
Showing
12 changed files
with
2,342 additions
and
45 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,080 changes: 1,080 additions & 0 deletions
1,080
Output/visualization data/young_1.jpg/pilot_01/matrix.csv
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,080 changes: 1,080 additions & 0 deletions
1,080
Output/visualization data/young_2.jpg/pilot_01/matrix.csv
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
addpath('gbvs'); | ||
addpath('eyetrackingstory_01/pilot_data/free_ebooks'); | ||
addpath('eyetrackingstory_01/stimuli/free_ebooks/young/withbackground'); | ||
addpath('eyetrackingstory_01/stimuli/free_ebooks/old/withbackground'); | ||
|
||
output_root_blank = 'Output/NoImage/'; | ||
output_root_image = 'Output/WithImage/'; | ||
|
||
% gaze dispersion | ||
|
||
data = readtable('samplereport_pilotdata.xlsx'); | ||
|
||
image = char(''); | ||
blank_img = repmat(255, 1, 1, 1); | ||
file = char(''); | ||
eye = char(''); | ||
output_filename = ''; | ||
matrix = zeros(1, 1); | ||
matrices = containers.Map; | ||
first = true; | ||
%height(data) | ||
for row_index = 1:500 | ||
disp(row_index); | ||
try | ||
row = data(row_index, :); | ||
string_array = table2array(row(1, {'DATA_FILE', 'image', 'EYE_TRACKED'})); | ||
[current_file, current_image, current_eye] = string_array{:}; | ||
if(~isKey(matrices, current_image)) | ||
image_object = imread(current_image); | ||
[img_height, img_width, img_dim] = size(image_object); | ||
blank_img = repmat(255, img_height, img_width, img_dim); | ||
matrices(current_image) = zeros(img_height, img_width); | ||
end | ||
|
||
matrix = matrices(current_image); | ||
|
||
if(strcmp(current_eye, 'Right')) | ||
number_array = table2array(row(1, {'RIGHT_GAZE_X', 'RIGHT_GAZE_Y'})); | ||
else | ||
number_array = table2array(row(1, {'LEFT_GAZE_X', 'LEFT_GAZE_Y'})); | ||
end | ||
|
||
if(any(isnan(number_array))) | ||
continue | ||
end | ||
|
||
number_array_cell = num2cell(number_array); | ||
[x_coord, y_coord] = number_array_cell{:}; | ||
x_coord = int16(x_coord); | ||
y_coord = int16(y_coord); | ||
if(x_coord > 0 && x_coord <= img_width && y_coord > 0 && y_coord <= img_height) | ||
matrix(y_coord, x_coord) = matrix(y_coord, x_coord) + 1; | ||
matrix(5, 5) = matrix(5, 5) + 1; | ||
matrices(current_image) = matrix; | ||
end | ||
catch error | ||
disp('Error'); | ||
disp('\n'); | ||
end | ||
end | ||
|
||
image_keys = keys(matrices); | ||
for key_index = 1:length(image_keys) | ||
current_image_cell = image_keys(key_index); | ||
current_image = current_image_cell{:}; | ||
matrix = matrices(current_image); | ||
image_object = imread(current_image); | ||
|
||
matrix = imgaussfilt(matrix, 2); | ||
matrix = rescale(matrix); | ||
hist_blank = heatmap_overlay(blank_img, matrix); | ||
hist_image = heatmap_overlay(image_object, matrix); | ||
|
||
output_filename = strcat('output-', current_image, '.png'); | ||
output_filename = erase(output_filename, {'.jpg', '.edf'}); | ||
output_filename_image = strcat(output_root_image, output_filename); | ||
output_filename_blank = strcat(output_root_blank, output_filename); | ||
imwrite(hist_image, output_filename_image); | ||
imwrite(hist_blank, output_filename_blank); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters