Save screenshot each 10 seconds

12 Ansichten (letzte 30 Tage)
Bekbol Sultankulov
Bekbol Sultankulov am 3 Apr. 2019
Kommentiert: Walter Roberson am 3 Apr. 2019
Hello everyone. I need help. I am a new matlab user. I am taking screenshot of PC desktop each 10 seconds and how screenshots could be saved in one folder for further processing.Thank you in advance
while 1
robot = java.awt.Robot();
pos = [529 132 313 555]; % [left top width height]
rect = java.awt.Rectangle(pos(1),pos(2),pos(3),pos(4));
cap = robot.createScreenCapture(rect);
rgb = typecast(cap.getRGB(0,0,cap.getWidth,cap.getHeight,[],0,cap.getWidth),'uint8');
imgData = zeros(cap.getHeight,cap.getWidth,3,'uint8');
imgData(:,:,1) = reshape(rgb(3:4:end),cap.getWidth,[])';
imgData(:,:,2) = reshape(rgb(2:4:end),cap.getWidth,[])';
imgData(:,:,3) = reshape(rgb(1:4:end),cap.getWidth,[])';
imshow(imgData)
imwrite(imgData,'out.png')
end

Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by