简体   繁体   English

快速截屏Java

[英]Fast screen capture Java

I'm trying to create Ambilight using some LED strips connected to a Raspberry Pi running Raspbian. 我正在尝试使用连接到运行Raspbian的Raspberry Pi的一些LED灯条创建流光溢彩。 I'm building an application with Java which has to read out the colors of the pixels on all sides of the screen so I can use those to color the LEDs behind the screen. 我正在用Java构建一个应用程序,它必须读出屏幕四周的像素颜色,这样我就可以用它来为屏幕后面的LED上色。

I've tried making screenshots with robot.createScreenCapture() but it takes +- 45ms to run that line which causes the LEDs to change color way too late. 我已经尝试使用robot.createScreenCapture()制作屏幕截图,但运行该行需要+ - 45ms,这会导致LED太晚改变颜色。

Does anyone have an idea of how to create a screenshot faster or how to get the pixel colors another way which reduces the ms? 有没有人知道如何更快地创建截图或如何获得像素颜色另一种方式,以减少ms?

This is the method I currently use to get a screenshot: 这是我目前用于获取屏幕截图的方法:

Robot robot = new Robot();
Rectangle area = new Rectangle(0, 0, this.screenSize.width, this.screenSize.height);
BufferedImage bufferedImage = robot.createScreenCapture(area); //Slow line

在机器人上使用方法getPixelColor()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM