How to build an images array?

How to build an images array? since I wanna put 90 frames buffer into 90 images, it’s stupid to declare 90 imges…


you can use a vector of ofImage to store your images :

vector<ofImage> images;
1 Like

Oh I see!!Thx

You can use images.reserve(90); to create the array faster

but here is another problem…when build an images array, then I have to build the unsigned char*[ ] = img[ ].getPixels();
which cause a “thread_bad_access” to me

what do you mean by “build” an array ?

here is my ofApp.h:

here is my ofApp.cpp:

I just want to put my buffer array into an Image array…

so let say you are using ofImage

declare an array

vector<ofImage> images;

optionally reserve array space


copy your image to the array

1 Like

thank you,but buffer is an array of unsigned char* …not ofImage…so how to pass it into the images[90 ]?

can you share the code ?

here is my code, I use an slitScan addon , but I just used the buffer** array in it…to draw every frame of buffer in my screen, could you tell me the way pass the buffer array to my image array? (13.8 KB)

here is my code

when I run it,it can build succeeded but in ‘ofImage.cpp’there is an error"Thread 1:EXC_BAD_ACCESS’ imediately as below:

what are you trying to store in your array ? result of slitscan image process ? what does the image you are storing look like ?

yes I want to store the result of slitscan process buffer in my array, the images I’m storing are every frame of the slitScan.
even draw one image of array would cause the bad_access
my code:


but when i just use an ofImage instead of vector, it works without problem.

ok. I don’t know the slitscan addon, but you can grab an image from slitscan using getOutImage() which returns an ofImage.

so no need for a buffer, you can grab the processed image like so

// images is a vector of ofImage