function screen_capture(movie_name,recording_time)
%Can be used to record any screen activity and output
%the recorded actions as video file (MOVIE.avi). It also saves the frames used to
%create the movie in a jpg format frames. The images are named as
%scrcapture -frame number- .jpg
%For example the first frame is named scrcapture1.jpg
%The recording time is almost identical to the actual cpu time.
%The quality of the video is excellent, but the size is big. One is advised
%to record short videos(order of minutes).For even better quality, one could replace the
% png format to jpg(simply uncomment the respective commands).
% to call the function, one types:
%
% screen_capture(movie_name,recording_time)
% where
% movie_name: is a string representing the name of the movie
% recording_time: is the length of the capturing (in seconds)
%To try, one might use the following example:
% screen_capture('movie',30)
%When the code is done writing the movie, a gong sound will be played
%to inform the user that the movie is finished.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This function is written by :
% Nassim Khaled
% Wayne State University
% Phd Candidate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
movie_name1=strcat(movie_name,'.avi')
mov = avifile(movie_name1);
count=0;
robo = java.awt.Robot;
t = java.awt.Toolkit.getDefaultToolkit();
rectangle = java.awt.Rectangle(t.getScreenSize());
number_of_frames=round(recording_time/0.65);
display_time_of_frame=10;
for i=1:number_of_frames
name1=strcat('scrcapture',num2str(i),'.png');
% name1=strcat('scrcapture',num2str(i),'.jpg');
image = robo.createScreenCapture(rectangle);
filehandle = java.io.File(name1);
javax.imageio.ImageIO.write(image,'png',filehandle);
% javax.imageio.ImageIO.write(image,'jpg',filehandle);
end
for i=1:number_of_frames
name1=strcat('scrcapture',num2str(i),'.png');
% name1=strcat('scrcapture',num2str(i),'.jpg');
a=imread(name1);
while count<display_time_of_frame
count=count+1;
F = im2frame(a);
mov=addframe(mov,F);
end
count=0;
end
close all
mov=close(mov);
load gong;
wavplay(y,Fs)
screen_capture.zip_Capture_MATLAB小玩意
版权申诉
153 浏览量
2022-07-15
04:27:45
上传
评论
收藏 1KB ZIP 举报
小贝德罗
- 粉丝: 69
- 资源: 1万+
最新资源
- #P0015. 全排列 超级简单
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0