Hi folks! New here, this is my first project in oF.
What I’m trying to do is to build a video scratcher by filling in a buffer from my webcam and playing it back.
I’m using a vector of ofTexture for memory optimization. At each update cycle I store the current frame in an ofImage (named colorImg) and then pass it to the vector. Everything works fine, except that when I try to store for example one minute of video (3600 frames) I still have 2gb ram usage. Does the ofImage allocate a new one at each cycle? How could i solve this?
Thanks!
daniele
vector<ofTexture> buffer;
void ofScratcher::write(ofImage *frame){
buffer[wPos].allocate(*frame);
}
void ofApp::update(){
ofBackground(100,100,100);
bool bNewFrame = false;
vidGrabber.update();
bNewFrame = vidGrabber.isFrameNew();
if (bNewFrame){
colorImg.setFromPixels(vidGrabber.getPixels());
scratcher.write(&colorImg);
}
scratcher.setwPos();
scratcher.setrPos();
}