Play image sequence

Hi,

I am wondering if is possible to use a sequence of images as a looping animation, for my objects? I am planing on using this for my boids in a simple 2d flocking system.

Lets say I have image0.png, image1.png, … image10.png, how can I use them as a loop animation?

Cheers
rS

I tried this by loading each .png from disk to an ofImage on each frame. It was very slow.

I tried also to load first all images into a vector of ofImages, but this works only if you have enough ram for all your pictures.(I had thousends of them). But with a small amount of images it seems fast enough.

Finaly a decided to convert my images with an utlility program (virtualdub on windows) and loaded the resulting file with the ofMovie player. (Final Cut on Macintosh seem to have the same utility but I don’t have the program)

So it depends what you wants to do, and also if the pictures have to be processed in the same order or not.

Hello, I have an efficient buffered image sequencer addon (ofxSlideShow).

Basically you specify a list of images as fileNames, and it iterates through them, preloading/buffering a set number of frames before and after the current frame.

It works very nicely for playing and scrubbing through animations/image sequences.

I should hopefully be releasing this addon soon-ish. I need to clear it with my client first, test it in OF 0061 and prepare an example though.

It doesn’t have looped buffer functionality yet (ie. if you are at the end, it buffers the start frames), but this is something I intend to add.

Sorry it’s not ready yet, but it is something you can watch for in the next couple of weeks :slight_smile:

Seems realy promising ! thanks in advance !

Thanks a lot, I will post any progress

Cheers
rS

Here is how I did it,
I load a sequence of images in an array, then in the display method, i do:

  
  
for (unsigned i = 0; i < boids.size(); i++) {  
	Boid* boid = boids.at(i);  
	// update image animation  
	boid->skin = skin[ofGetFrameNum() % 4];  
	boid->display();  
}  
  

boid->skin = skin[ofGetFrameNum() % 4]; I use 4 because that is the number of images in the array, so I get 0, 1, 2, 3, 4, 0, 1, 2, 3, … in the loop

Now by doing this I came across another unrelated issue, I am loading the images like this:

  
  
skin[0].loadImage("bugwalking00.png");  
skin[1].loadImage("bugwalking01.png");  
skin[2].loadImage("bugwalking02.png");  
skin[3].loadImage("bugwalking03.png");  
  

I know, not the best approach, but when I try:

  
  
for (unsigned i = 0; i < 4; i++)  
     skin[i].loadImage("bugwalking0" + i + ".png");  
  

I get the error: invalid operands of types ‘const char*’ and ‘const char [5]’ to binary 'operator+'

And if i try:

  
for (unsigned i = 0; i < 4; i++)  
	skin[i].loadImage("bugwalking0" + ofToString(i) + ".png");  
  

get the following error: call of overloaded ‘ofToString(unsigned int&)’ is ambiguous

Any ideas?

Cheers
rS

try something like:

  
  
stringstream nameBuilder;  
for (unsigned i = 0; i < 4; i++){  
     nameBuilder << "bugwalking0" << i << ".png";  
     skin[i].loadImage(nameBuilder.str());  
     nameBuilder.str("");  
}  
  

Also, I got approval from my client to release it, and should have that buffered image sequencer ready sometime this week.

Hi plong0, thanks for the suggestion is much better now.

Looking forward for your release

Cheers
rS

Hi plong0.

Sounds like ofxSlideShow is exactly what I’m after. Did it ever see the light of day?

Cheers
Louis

Hey everyone,

Found this thread and thought I’d share my ofxImageSequence addon i made this summer for a project. It takes a series of sequentially named files and let’s you play them a lot like you would a movie file.

you can download the addon and an example from my github:

https://github.com/obviousjim/FlightPha-…-geSequence

hope it’s useful to some out there =)

[quote author=“obviousjim”]Hey everyone,

Found this thread and thought I’d share my ofxImageSequence addon i made this summer for a project. It takes a series of sequentially named files and let’s you play them a lot like you would a movie file.

you can download the addon and an example from my github:

https://github.com/obviousjim/FlightPha-…-geSequence

hope it’s useful to some out there =)[/quote]
Thanks Jim. Also great - the Sniff animation - awsome.

1 Like