I just started working with Processing, because I need to get a sequence of images, color and depth. When I save does images while drawing, so for each image I get I save it. I have around 2fps. Is there a way to improve this?
My thought was to store the image in an array list. I thought there is a function setup() so there would be also a function shutdown() or something. So When i hit the Esc button or close the window which is getting cold. Like a decompiler. Where I can run a loop trough that lists and save them. But I don't find such a function.
I am working on a MacBook Air (2013)
If you use OpenNI/SimpleOpenNI I recommend a nicer option: use the the .oni format (which stores both depth and rgb streams). All you have to do is:
To record to an .oni file you've got two options:
brew install homebrew/science/openni2
. The path in this case will be something like /usr/local/Cellar/openni2/2.2.0.33/share/openni2/tools/NiViewer
)Once you have your .oni file, you can easily read it/play it back at different rate and access depth/rgb streams to save to disk.
Regarding your existing program The frame rate drops because in the same thread it's encoding and writing two images to disk per frame. You can improve this by: