This file is indexed.

/usr/share/psychtoolbox-3/PsychOneliners/SaveMovieFrames.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
function SaveMovieFrames(framenr,filmnaam,filmdir,outdir)
% function SaveMovieFrames(framenr,filmname,filmdir,outdir):
%
% loads a GUI in which movie FILMNAME in FILMDIR can be played and seeked
% through. Movie is opened on frame FRAMENR. Screenshots of frames can be
% saved as png in OUTDIR by pressing the save button.

% JJvR 26-02-2008

%% Initialise GUI figure

        figure;
        set(gcf,'Visible','off','Position',[600 300 900 600]);
        set(gca,'Position',[.1 .1 .7 .8]);
        axis ij; axis equal; axis off;
        data    = guidata(gcf);
        data.filmnaam   = filmnaam;
        data.framenr    = framenr;
        data.filmdir    = filmdir;
        data.outdir     = outdir;
        data.filminfo   = aviinfo([data.filmdir filesep data.filmnaam]);
        pause on;
        guidata(gcf,data);

        takeframe;
        plotframe;

        hpluseen = uicontrol(...
            'Style','pushbutton',...
            'String','Next Frame',...
            'Position',[750,500,120,40],...
            'Callback',{@Pluseen_Callback},...
            'Tag','Pluseen');

        hmineen = uicontrol(...
            'Style','pushbutton',...
            'String','Prev Frame',...
            'Position',[750,425,120,40],...
            'Callback',{@Mineen_Callback},...
            'Tag','Mineen');

        hplusvijf = uicontrol(...
            'Style','pushbutton',...
            'String','5 forward',...
            'Position',[750,350,120,40],...
            'Callback',{@Plusvijf_Callback},...
            'Tag','Plusvijf');

        hminvijf = uicontrol(...
            'Style','pushbutton',...
            'String','5 back',...
            'Position',[750,275,120,40],...
            'Callback',{@Minvijf_Callback},...
            'Tag','Minvijf');

        hplay = uicontrol(...
            'Style','togglebutton',...
            'String','Play',...
            'Position',[750,200,120,40],...
            'Callback',{@Play_Callback},...
            'Tag','Minvijf');

        hSave = uicontrol(...
            'Style','pushbutton',...
            'String','Save',...
            'Position',[750,125,120,40],...
            'Callback',{@Save_Callback},...
            'Tag','SaveButton');

        hTerug = uicontrol(...
            'Style','pushbutton',...
            'String','Close',...
            'Position',[750,50,120,40],...
            'Callback',{@Terug_Callback},...
            'Tag','SaveButton');
        
        set(gcf,'Visible','on');
    end
%% Callbacks

    function Pluseen_Callback(source,eventdata,handles)
        updaterelframe(1);
        plotframe;
    end

    function Mineen_Callback(source,eventdata,handles)
        updaterelframe(-1);
        plotframe;
    end

    function Plusvijf_Callback(source,eventdata,handles)
        updaterelframe(5);
        plotframe;
    end

    function Minvijf_Callback(source,eventdata,handles)
        updaterelframe(-5);
        plotframe;
    end
    
    function Play_Callback(source,eventdata,handles)
        data = guidata(gcf);
        playing = true;
        while playing
            if (get(gcbo, 'Value')) == 0
                playing = false;
            end   
            updaterelframe(1);
            pause(1/25);
            plotframe;
        end
    end
    
    function Save_Callback(source,eventdata,handles)
        data = guidata(gcf);
        if ~isdir(data.outdir)
            mkdir(data.outdir);
        end
        imwrite(data.film(data.relframe).cdata,[data.outdir filesep data.filmnaam(1:end-4) ' frame ' num2str(data.framenr - 21 + data.relframe) '.png'],'png');
    end

    function Terug_Callback(source,eventdata,handles)
        close(gcf);
    end
%% Supporting functions

    function takeframe
        data = guidata(gcf);
        data.addrelframe = 0;
        if data.framenr + 40 > data.filminfo.NumFrames
            data.addrelframe = 40 - (data.filminfo.NumFrames - data.framenr);
            data.framenr = data.filminfo.NumFrames - 40; 
            if data.addrelframe > 40
                data.addrelframe = 40;
            end
        elseif data.framenr - 10 < 1
            data.addrelframe = data.framenr - 10;
            data.framenr = 11;
            if data.addrelframe < -10
                data.addrelframe = -10;
            end
        end
        
        data.film = aviread([data.filmdir filesep data.filmnaam], data.framenr-10:data.framenr+40);
        data.relframe = 11 + data.addrelframe;
 
        guidata(gcf,data);
    end

    function plotframe
        data = guidata(gcf);
        image(data.film(data.relframe).cdata);
    end

    function updaterelframe(input)
        data = guidata(gcf);
        data.relframe = data.relframe+input;
        guidata(gcf,data);
        checkrelframe;
    end
    
    function checkrelframe
        data = guidata(gcf);
        if data.relframe > 51  || data.relframe < 1
            getnewrelframe;
        end
    end
    
    function getnewrelframe
        data = guidata(gcf);
        data.framenr = (data.framenr - 11 + data.relframe);
        guidata(gcf,data);
        takeframe;
    end