ofImage, vectors, and ofThread

I have a large sequence of large images (1920x1080) that I am loading in to a vector. I need to be able to iterate through these images, pick the darkest pixel at each point across all of the frames, and dump the result into a new image.

I managed to get this running fairly quickly in Processing by creating multiple threads, each assigned to process a single line of pixels. Each thread would get a reference to an array, and a reference to the final image. Because Processing passes objects by reference, I’m able to update the image I am rendering while drawing it in real time without having to return any values.

I have tried to implement this in oFx. Running the analysis in the main portion of the application works fine when it is not threaded. However, once I push this process out to threads, I get Poco::Thread and Poco::FastMutex errors (‘operator=’ is a private member).

Overall, I’m fairly new to openFrameworks and C++, but my guess is that this has to do with trying to pass these object by reference. Is there a better/more proper/more efficient way of going about this?

Below is some psuedocode to illustrate the basics of my pixel processing loop.

vector<ofImage> images; //reference to vector of images loaded in main.cpp  
ofImage finalImage; //reference to image created in main.cpp  
int pixelStartX;  
int pixelStartY;  
int pixelEndX;  
int pixelEndY;  
void myThreadUpdateLoop(){  
  for(int pixelY = pixelStartY; pixelY < pixelEndY; pixelY++){  
    for(int pixelX = pixelStartX; pixelX < pixelEndX; pixelX++){  
      finalImage.setPixel(pixelX, pixelY, findDarkestColor(pixelX,pixelY));  
/*looks at the pixel in this location in all the frames and find the darkest*/  
ofColor findDarkestColor(pixelX, pixelY){  
  for(int frame = 0; frame < images.length; frame++){  
    /*code for comparing pixels at this given point across all frames, determining   
    which is the darkest and returning that color*/  

you can put threads in vectors cause those classes are non copiable. instead you can put pointers to threads in a vector like:

vector<ofThread *> threads;  
threads.push_back(new ofThread);  

or using smart pointers (will autodelete themselves when the vector is emptied):

vector<ofPtr<ofThread> > threads;  
threads.push_back(ofPtr<ofThread>(new ofThread));