Save screenshot each 10 seconds

12 visualizaciones (últimos 30 días)
Bekbol Sultankulov
Bekbol Sultankulov el 3 de Abr. de 2019
Comentada: Walter Roberson el 3 de Abr. de 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

Respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by