This file is indexed.

/usr/share/psychtoolbox-3/PsychAlpha/ImageWarpingDemo.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
function ImageWarpingDemo

% PTB-3 properly installed and working?
AssertOpenGL;

% Select display with max id for our onscreen window:
screenid = max(Screen('Screens'));

try
    % Open onscreen window with black background clear color:
    [win, winRect] = Screen('OpenWindow', screenid, 0);
    [xp, yp] = RectCenter(winRect);
    SetMouse(xp, yp, win);
    
    % Read our beloved bunny image from filesystem:
    bunnyimg = imread([PsychtoolboxRoot 'PsychDemos/konijntjes1024x768.jpg']);
    bunnytex = Screen('MakeTexture', win, bunnyimg);
    
    bunnyRect = CenterRect(Screen('Rect', bunnytex), winRect);
    xoffset = bunnyRect(RectLeft);
    yoffset = bunnyRect(RectTop);
    
    % Create warpoperator for application of the image warp:
    warpoperator = CreateGLOperator(win);
    warpmap = AddImageWarpToGLOperator(warpoperator, winRect);
    
    w = floor(size(bunnyimg,2)/5);
    h = floor(size(bunnyimg,1)/5);
    [x,y]=meshgrid(-w/2:w/2,-h/2:h/2);
    warpimage = zeros(h+1, w+1, 3);
    
    warpedtex = 0;
    count = 0;
    
    while ~KbCheck
        % Update framecounter: This is also used as our "simulation time":
        count = count + 1;

        % Query mouse to find out where to place the "warp map":
        [xp, yp] = GetMouse(win);
        xp = xp - xoffset;
        yp = yp + yoffset;

        % Compute a texture that contains the distortion vectors:
        % Red channel encodes x offset components, Green encodes y offsets:

        % Here we apply some sinusoidal modulation:
        warpimage(:,:,1) = (sin(sqrt((x/10).^2 + (y/10).^2) + count/10) + 1) * 6;
        warpimage(:,:,2) = (cos(sqrt((x/10).^2 + (y/10).^2) + count/10) + 1) * 6;

        % Its important to create a floating point texture, so we can
        % define fractional offsets that are bigger than 1.0 and negative
        % as well:
        modtex = Screen('MakeTexture', win, warpimage, [], [], 1);

        % Update the warpmap. First clear it out to zero offset, then draw
        % our texture into it at the mouse position:
        Screen('FillRect', warpmap, 0);
        Screen('DrawTexture', warpmap, modtex, [], CenterRectOnPoint(Screen('Rect', modtex), xp, yp));
        
        % Delete texture, it will be recreated at next iteration:
        Screen('Close', modtex);
        
        % Apply image warpmap to our bunny image:
        warpedtex = Screen('TransformTexture', bunnytex, warpoperator, warpmap, warpedtex);

        % Draw and show the warped bunny:
        Screen('DrawTexture', win, warpedtex);
        Screen('Flip', win);
    end
        
    % Done. Close display and return:
    Screen('CloseAll');
    return;
    
catch
    Screen('CloseAll');
    psychrethrow(psychlasterror);
end