Save screenshot each 10 seconds
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
1 comentario
Walter Roberson
el 3 de Abr. de 2019
See https://www.mathworks.com/matlabcentral/answers/451721-loop-in-realtime-arduino-reading#comment_684969 for discussion of timer objects.
Respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!