Skip to content

Instantly share code, notes, and snippets.

@yusuketomoto
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusuketomoto/4ffed52e0c2284152030 to your computer and use it in GitHub Desktop.
Save yusuketomoto/4ffed52e0c2284152030 to your computer and use it in GitHub Desktop.
channel spilit and merge
#include "ofMain.h"
#include "ofxCv.h"
using namespace ofxCv;
using namespace cv;
class ofApp : public ofBaseApp {
ofImage image;
public:
void setup()
{
image.loadImage("test.jpg");
Mat mat = toCv(image);
vector<Mat> rgb;
cv::split(mat, rgb);
vector<Mat> ggg;
while (ggg.size() < 3)
ggg.push_back(rgb[1]);
merge(ggg, mat);
}
void update()
{
image.update();
}
void draw()
{
image.draw(0, 0);
}
void keyPressed(int key)
{
}
};
//========================================================================
int main( ){
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment