Code covered by the BSD License  

Highlights from
deprecated -- Light Field Toolbox v0.2 -- v0.3 now available

image thumbnail

deprecated -- Light Field Toolbox v0.2 -- v0.3 now available

by

 

26 Apr 2013 (Updated )

A set of tools for working with light field (aka plenoptic) imagery in Matlab

LFDispSetup( InitialFrame, ScaleFactor )
% LFDispSetup - utility function used to set up a light field display
% 
% Usage: 
% 
%     [ImageHandle, FigureHandle] = LFDispSetup( InitialFrame )
%     [ImageHandle, FigureHandle] = LFDispSetup( InitialFrame, ScaleFactor )
% 
% 
% This sets up a figure for LFDispMousePan and LFDispVidCirc. The figure is configured for
% high-performance display, and subsequent calls will reuse the same figure, rather than creating a
% new window on each call. The function should handle both mono and colour images.
% 
% 
% Inputs:
% 
%     InitialFrame : a 2D image with which to start the display
% 
% Optional Inputs: 
% 
%     ScaleFactor : Adjusts the size of the display -- 1 means no change, 2 means twice as big, etc.
%                   Integer values are recommended to avoid scaling artifacts. Note that the scale
%                   factor is only applied the first time a figure is created -- i.e. the figure
%                   must be closed to make a change to scale.
% 
% Outputs:
% 
%     FigureHandle, ImageHandle : handles of the created objects
%
%
% See also:  LFDispVidCirc, LFDispMousePan

% Part of LF Toolbox v0.2 released 27-May-2013
% Copyright (c) 2013, Donald G. Dansereau

function [ImageHandle, FigureHandle] = LFDispSetup( InitialFrame, ScaleFactor )

Mono = (ndims(InitialFrame) == 2);

FigureHandle = findobj('tag','LFDisplay');
if( isempty(FigureHandle) )
    FigureHandle = figure(...
        'doublebuffer','on',...
        'backingstore','off',...
        ...%'menubar','none',...
        ...%'toolbar','none',...
        'tag','LFDisplay');
    WindowPos = get(FigureHandle, 'Position');
    WindowSize = WindowPos(3:4);
    % We position the window slighly lower than center to allow space for the title
    WindowStart = floor((WindowSize - size(InitialFrame(:,:,1))) .* [0.5, 0.2]);
    axes('units','pixels',...
         'Position', [WindowStart, size(InitialFrame(:,:,1))],...
         'xlimmode','manual',...
         'ylimmode','manual',...
         'zlimmode','manual',...
         'climmode','manual',...
         'alimmode','manual',...
         'layer','bottom');
    ImageHandle = imshow(InitialFrame);
    % If a scaling factor is requested, apply it
    if( exist('ScaleFactor','var') )
        truesize(floor(ScaleFactor*size(InitialFrame(:,:,1))));
    end
    if( Mono )
        colormap(gray(256));
    end
else
    ImageHandle = findobj(FigureHandle,'type','image');
    set(ImageHandle,'cdata', InitialFrame);
end

Contact us