Hello everybody,
I am trying to manipulate a video input with data from a software program that is running on the PC itself. basically, i try to implement information from the PC screen into the live video screen. however, I need a way to read the pixels of the PC screen itself, and not a “sketch” or processing window.
Does anyone know if this is possible? or are there other handy ways to do this? for example by recording a part the computer screen and displaying it in processing as a live stream?
hopefully someone can give me the answer! Thanks!
1 Like
This is black magic that isn’t something you can do easily and might not work at all. Here’s a starting point for you.
import java.awt.Robot;
import java.awt.Rectangle;
import java.awt.AWTException;
PImage screenshot;
int x, y;
void setup() {
size(600, 400);
}
void draw() {
screenshot();
image(screenshot, 0, 0, width, height);
}
void screenshot() {
try {
Robot robot = new Robot();
screenshot = new PImage(robot.createScreenCapture(new Rectangle(0, 0, displayWidth, displayHeight)));
}
catch (AWTException e) {
}
}
1 Like
Do you need the live stream? If not, then check any desktop capture app. You can save what you see in your desktop’s scree as a movie and process it afterwards.
Kf