You are on page 1of 4

Table of Contents

Drawing image .................................................................................................................. 1


Create structure .................................................................................................................. 2
Find coordinates for trial ..................................................................................................... 2
Histogram for values in Red-channel for fixation points ............................................................ 2
Histogram for values in blue-channel for fixation points ............................................................ 3
Histogram for values in green-channel for fixation points .......................................................... 3
Histogram for values in lila-channel for fixation points ............................................................. 3
Cut border from image ........................................................................................................ 3
Second subplot ................................................................................................................... 3

Drawing image
im = imread('img.bmp'); %RGB Matrix
fig1 = figure
subplot(1,1,1) % First subplot
imagesc(im)

fig1 =

1
Create structure
s = struct();
s.x = randi(1000,[6, 1]);
s.y = randi(1000,[6, 1]);
s.trial = [1,2,3,1,2,3];

%axes;

% Create labels
xlabel({'cols-dimension pixels'});
ylabel({'rows-dimension pixels'});
title({'all subjects fixations'});

Find coordinates for trial


t1 = s.x(s.trial==1);
t2 = s.x(s.trial==2);
t3 = s.x(s.trial==3);

Histogram for values in Red-channel for fixa-


tion points
figure

2
tmp_im = im(:,:,1);
fix_indx = sub2ind(size(tmp_im), s.y, s.x);
tmp = tmp_im(fix_indx);
fix_hist = hist(tmp(:),0:50);
bar(fix_hist)

Error using sub2ind (line 52)


Out of range subscript.

Error in HM2 (line 29)


fix_indx = sub2ind(size(tmp_im), s.y, s.x);

Histogram for values in blue-channel for fixa-


tion points
figure
tmp_im = im(:,:,2);
fix_indx = sub2ind(size(tmp_im), s.y, s.x);
tmp = tmp_im(fix_indx);
fix_hist = hist(tmp(:),0:50);
bar(fix_hist)%% Histogram for values in blue-channel for fixation points

Histogram for values in green-channel for fixa-


tion points
figure
tmp_im = im(:,:,3);
fix_indx = sub2ind(size(tmp_im), s.y, s.x);
tmp = tmp_im(fix_indx);
fix_hist = hist(tmp(:),0:50);
bar(fix_hist)%% Histogram for values in green-channel for fixation points

Histogram for values in lila-channel for fixation


points
figure
tmp_im = im(:,:,4);
fix_indx = sub2ind(size(tmp_im), s.y, s.x);
tmp = tmp_im(fix_indx);
fix_hist = hist(tmp(:),0:50);
bar(fix_hist)%% Histogram for values in lila-channel for fixation points

Cut border from image


im = im(200:size(im,1)-200,300:size(im,2)-300,:);

Second subplot
figure(fig1) % Continue working on the first figure

3
subplot(1,1,1);
imagesc(im)

Published with MATLAB® R2013a

You might also like