ofxCvColorImage + setFromPixels via ofTexture?

Hello everyone,

So I am trying to load the Pixels from an ofTexture (in this case ‘_browser’) into a ofxCvColorImage so I can then scale that down into a second ofxCvColorImage which I can then easily and without too much CPU effort loop over and read the pixels to send out RGB data via OSC.

It theory it sounds simple enough but in practice it is giving me some trouble. Any help would be greatly appreciated!

On the line specified below I get the following error code :

No instance of overloaded function “ofxCvColorImage::setFromPixels” matches the argument list
argument types are: (ofxAwesomiumPlus, int, int)
object type is: ofxCvColorImage

Error C2664 ‘void ofxCvColorImage::setFromPixels(const unsigned char *,int,int)’: cannot convert argument 1 from ‘ofxAwesomiumPlus’ to ‘const unsigned char *’

void ofApp::update(){


    std::stringstream strm;
    strm << "fps: " << ofGetFrameRate();

    ofxOscMessage m;

    if (_browser.update()) {

// Load pixels from Browser into Image A
        ofxCvColorImage imageA;
        imageA.setFromPixels(_browser, ofGetWidth(), ofGetHeight());     /***** ERROR HERE *****/
        ofxCvColorImage imageB;
        imageB.allocate(192, 108);

// Scale down Image A into Image B

// Loop through Image B to get the pixel data                  
                int w = ofGetWidth()/10;
                int h = ofGetHeight()/10;
                int bpp = 3;
               for (int col = 0; col < w; col++) {
                    for (int row = 0; row >= 0; row--) {
                        int base = (row * w + col) * bpp;
                        unsigned char red = pixels[base];
                        unsigned char green = pixels[base + 1];
                        unsigned char blue = pixels[base + 2];

 // Add RGB data to outgoing OSC message
                sender.sendMessage(m, false);

Any ideas what I’m doing wrong?

Many thanks,


Hi Joe,

It’s quite obvious that you get an error there because _browser is of type ofxAwesomiumPlus and the setFromPixels() needs a PixelType as the first parameter.

You can get the pixels from an ofImage. My addon uses a frame variable which is of type ofImage and you can create a getter there:

// ofxAwesomiumPlus.h
ofImage getFrame();

// ofxAwesomiumPlus.cpp
ofImage ofxAwesomiumPlus::getFrame() {
    return frame;

Then in your code:

imageA.setFromPixels(_browser.getFrame().getPixels(), ofGetWidth(), ofGetHeight());

This is just a hunch though so it might not work. Give it a try and let me know how it goes. I’ll look into it when I get to my machine.

Unfortunately I don’t have my machine with me at the moment so I can’t access my OF dev environment.

Hi Razvan, thanks for the response! I will try this right away and let you know how it goes.



So I have put in your suggestions and it gives no errors at all which is very promising. Unfortunately however, I am getting a LINK error, saying that the build can’t find the awesomium.lib file. This is something that has been happening on and off today and I just can’t figure it out!

I am pretty sure that I set everything up correctly. I am building this straight from your ‘example-basic’ from the addon folder, and I have dragged and dropped all the files from the awesomium sdk bin into the bin folder of the example.

I’ve double checked my linker settings which are as follows:

 Linker > General > Additional Library Directories  : $(AWE_DIR)build\lib
 Linker > Input > Additional Dependencies           : awesomium.lib

Additionally, I have made sure that my C++ include directory is as follows:

 C/C++ > General : $(AWE_DIR)include

Any ideas? I feel like there must be something blatantly obvious that I’ve missed!? Maybe I should be specifying the full path to the awesomium.lib in Additional Dependencies??

Thanks again,


Just to confirm you copied everything, have a look at awesomium’s setup page

Another thing might be that the example is built in VS 2015 so make sure you use the same IDE. (Probably you do if you work with OF9).

If it still happens, try to set up the project from the beginning using the Awesomium setup guide.

Yep I am using VS 2015 with 0.9.3.

All the files that I need are where they should be, although one thing I missed was including the
#include <Awesomium/WebCore.h>

I tried adding it to the ofApp.h but it had no effect. I tried it in ofApp.cpp and at the top of main.cpp aswell but to no avail.

I will try building a new project from scratch and see if that helps!

I have just seen that #include <Awesomium/WebCore.h> is already in the header file of your addon anyway which is probably why it had no affect…

So I just rebuilt the project from scratch, this time I created a new app instead of building from the example.

I followed the Awesomium setup instructions precisely, but I am still getting the exact same error!

Error LNK1104 cannot open file 'awesomium.lib;'

If it’s not too much to ask, is there any chance I can send you the src for you to try it on your machine?

Many thanks

I will get back to you as soon as I manage to try it out