0

I have a working program written in Java (a 3d game) and some scripts in Python written with theano to process images. I am trying to capture the frames of the game as it is running and run these scripts on the frames. My current implementation grabs the binary data from each pixel in the frame, saves the frame as a png image and calls the python script (using ProcessBuilder) which opens the image and does its thing. Writing an image to file and then opening it in python is pretty inefficient, so I would like to be able to pass the binary data from Java to Python directly.

If I am not mistaken, processBuilder only takes arguments as strings, so does anyone know how I can pass this binary data directly to my python script? Any ideas?

Thanks

SymX
  • 11
  • 1
  • you can [get Python's stdin as `OutputStream` easily](http://stackoverflow.com/q/11336157/4279) – jfs Oct 09 '15 at 05:41

1 Answers1

0

If there is no limit to the length of the string argument for launching the python script, you could simply encode the binary data from the image into a string, and pass that. The only problem you might encounter with this approach would be null characters and and negative numbers.