convertir vectors to images

hi, im very new with openframeworks im trying to make an old program i did before with processing in of.
The program works in this way, the program iterates over all the pixels of an image and create 3 news vectors or arrays based in its luminosty. My question is : which is the best way to converting back a vector into a image? if this is not possible which is the best way to draw a vector as an image?

here is an example of the code:
the 3 vectos are: oscuros, medios and claros, thanks

void testApp::keyPressed  (int key){  
    if (key = 358){  
        unsigned char * pixels = img.getPixels();  
        int w = img.width;  
        int h = img.height;  
        vector<int> claros;  
        vector<int> medios;  
        vector<int> oscuros;  
        for (int i = 0; i < w; i++){  
            for (int j = 0; j < h; j++){  
                int value = pixels[j * w + i];  
                //cout << value << endl;  
                if (value >= 0 && value <= 50)  
                else if (value >= 51 && value <= 101)  
    //cout < claros.  

you could always render your vectors on screen and then save the result to an ofImage. This would look a little like this (taken from the ofSaveScreen function):

        ofImage img;  
	img.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_COLOR);  
	img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());  

greets ph

thanks but how do i render the vectors with pixel data in the screen?


You can only do it manually with a series of ofLine(x1, y1, x2, y2) commands.

indeed a vector is internally just an array, so you can load it’s contents to a texture. it dependes on how you want to actually render it but let’s say you want to render it’s contents as a line:

ofTexture tex