@elliot wrote:
I am looking at trying to load in a video and get the frames so I can use them in a vector of ofImage. I want to be able to play back a section of the video by calling drawSubsection(). I would want to play back multiple sections from multiple videos eventually.
So far I have this. This plays back the video fine if I call
player.draw(...);
. But calling any part of the sequence vector to draw with drawSubsection shows a rectangle in the correct dimensions but a blank black rectangle.ofVideoPlayer player; vector <ofImage> sequence; // player.setPixelFormat(OF_PIXELS_RGB); player.load("back2.MOV"); player.setLoopState(OF_LOOP_NORMAL); for(int i= 0;i < player.getTotalNumFrames();i++ ) { player.nextFrame(); ofImage image; image.allocate(player.getWidth(), player.getHeight(), OF_IMAGE_COLOR); image.setFromPixels(player.getPixels()); sequence.push_back(image); } } //IN DRAW void ofApp::draw(){ for (int i = 0; i < sequence.size(); i++){ sequence[0].drawSubsection(50, 100, 100, 100, 0, 0); }
Any advice would be great!
Posts: 1
Participants: 1