Last active
August 29, 2015 14:01
-
-
Save yusuketomoto/4ffed52e0c2284152030 to your computer and use it in GitHub Desktop.
channel spilit and merge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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