image thumbnail

Simple StopMotion Film Studio

by

 

Capture frames from image aquisition devices and create your own stop motion animation.

SetFrames
function SetFrames

%% Global parameters

global Frames Objects Settings

%% Frame ID
switch get(gco,'Tag');
    case 'Slider'
        Settings.CurrentFrame = Settings.CurrentFrame;        
    case 'Next'
        Settings.CurrentFrame = Settings.CurrentFrame+1;
    case 'Previous'
        Settings.CurrentFrame = Settings.CurrentFrame-1;        
    case 'Capture'
        Settings.CurrentFrame = Settings.CurrentFrame;
    case 'Settings'
        Settings.CurrentFrame = Settings.CurrentFrame;
end

%% Set frame
if Settings.CurrentFrame ~= 0
    if Settings.CurrentFrame > size(Frames,2)
        Settings.CurrentFrame = 1;
    elseif Settings.CurrentFrame < 1
        Settings.CurrentFrame = size(Frames,2);
    end
        
    %% Set Counter
    Timer = datestr((Settings.CurrentFrame/Settings.FPS)/(60*60*24),'HH:MM:SS.FFF');
    str = sprintf('%s %3.0f/%3.0f (%3.0f fps)', Timer,Settings.CurrentFrame,Settings.TotalFrames,Settings.FPS);  
    set(Objects.Display,'String',str)
    
    %% Set Live view background image
    set(Objects.LiveViewFrameA,'CData',Frames(Settings.CurrentFrame).RGB);

    %% Set PreView Image
    set(Objects.PreViewFrameA,'CData',Frames(Settings.CurrentFrame).RGB);
end

Contact us