Im using ofxPS3EyeGrabber to get two cameras working simultaniously. I already have both images, but now i want to make blob detention on them using ofxOpenCv.
Now i need to get an ofxCvGrayscaleImage from an ofTexture. Here is what i have:
if (videoGrabbers[i]->isFrameNew())
{
videoTextures[i].loadData(videoGrabbers[i]->getPixelsRef());
}
a texture is memory in the graphics card and reading it back to an ofPixels which is in the computers memory would be slow. the easiest in your case would be to directly copy the pixels from the grabber to the cv image like:
oh, ok yes the image from the video camera is a color image and you are trying to put it in a grayscale one, you need to convert it first. take a look at the openCvExample where it shows how to do this conversion
Just wanted to add that @talaron’s solution worked for me, without much of a performance penalty. Thanks dude. Although, like you, I’m also still confused as to why.