本文整理汇总了C++中ofImage::setImageType方法的典型用法代码示例。如果您正苦于以下问题:C++ ofImage::setImageType方法的具体用法?C++ ofImage::setImageType怎么用?C++ ofImage::setImageType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofImage
的用法示例。
在下文中一共展示了ofImage::setImageType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup(){
ofSetVerticalSync(false);
w=ofGetScreenWidth();
h=ofGetScreenHeight();
ofDisableArbTex();
img.load("1.jpg");
player.load("1.mp4");
player.play();
player.setLoopState(OF_LOOP_NORMAL);
gray = img;
gray.setImageType(OF_IMAGE_GRAYSCALE);
wc.load("wcolor.vert","wcolor.frag");
ofFbo::Settings s;
s.depthStencilAsTexture=true;
s.useDepth=true;
s.width=w;
s.height=h;
fboDepth.allocate(s);
fbo.allocate(w,h);
fbo.begin();
ofClear(0,0,100,255);
fbo.end();
gui.setup();
gui.add(stepGradient.set("step gradient", .0015, -1., 1.));
gui.add(advectStep.set("step advect", .0015, -.1, .1));
gui.add(flipHeightMap.set("flip height map", 0.7, 0., 2.));
gui.add(time.set("time", 0., 0., 1.));
gui.add(advectMatrix.set("advect matrix", ofVec4f(0.1), ofVec4f(-1.), ofVec4f(1.)));
gui.add(switchVideo.set("switch video", false));
}
示例2: makeTransparent
void makeTransparent(ofImage &img) {
img.setImageType(OF_IMAGE_COLOR_ALPHA); //make sure it can have alphas
for(int i = 3; i < img.height*img.width*4; i+=4){
if(img.getPixels()[i-1]==0) { //if blue is 0 make pixel transparent
img.getPixels()[i]=0;
}
}
img.update();
}
示例3: loadImage
void loadImage(string filePath)
{
vector<string>hierarchy = ofSplitString(filePath, "/");
if (hierarchy.size() > 1)
cur_file = hierarchy.back();
else
cur_file = filePath;
img1.loadImage(filePath);
img1.resize(w, h);
img1.setImageType(OF_IMAGE_GRAYSCALE);
synthImage();
}
示例4: generateSpotlight
void captureApp::generateSpotlight(ofImage& img) {
int diffusion = 100;
img.setImageType(OF_IMAGE_GRAYSCALE);
unsigned char* pixels = img.getPixels();
int w = img.getWidth();
int h = img.getHeight();
float maxDistance = (w < h ? w : h) / 2;
for(int y = 0; y < h; y++) {
for(int x = 0; x < w; x++) {
int i = y * w + x;
int xrand = ofRandom(-diffusion, diffusion);
int yrand = ofRandom(-diffusion, diffusion);
pixels[i] = pow(ofMap(ofDist(w / 2, h / 2, x + xrand, y + yrand), 0, maxDistance, 1, 0, true), 4) * 255;
}
}
img.update();
}