do 5 slides for the slideshow use images from Google and cite the images as a co
ID: 3595827 • Letter: D
Question
do 5 slides for the slideshow use images from Google and cite the images as a comment on matlab
Explanation / Answer
MATLAB CODE:
%save any 5 imgs img1,img2,img3,img4 and img5 (all in jpg formats)
%in the same directory as these three files
%and run the main function() for slideshow
slideshow.m file:
%slideshow function adds a slide to the timed slideshow
function slideshow(varargin)
global indx
global imgNameList
imgNameList = char('img1.jpg','img2.jpg','img3.jpg','img4.jpg','img5.jpg');
indx=indx+1;
if indx> length(imgNameList)
indx=1;
end
a = imgNameList(indx,:);
imshow(a);
drawnow;
....
%save the code in video.m file and run function video() from command line
%to create a video of type mp4
video.m file:
myVideo = VideoWriter('myfile.mp4');
myVideo.FrameRate = 2; % Default 30
open(myVideo);
imgNameList = char('img1.jpg','img2.jpg','img3.jpg','img4.jpg','img5.jpg');
for ii = 1:length(imgNameList)
img = imread(imgNameList(ii,:));
writeVideo(myVideo,img)
end
close(myVideo);
....
%save the code in main.m file and run function main() from command line
%this will create a timed slideshow of the imgs
main.m file:
clc;
clear;
global indx
indx=0;
showTimer=timer('TimerFcn',@slideshow);
set(showTimer,'ExecutionMode','fixedRate');
set(showTimer,'Period',0.5) %% 2 sec delay
set(showTimer,'TasksToExecute',5)
start(showTimer)
....
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.