本文整理汇总了C++中ofImage::reloadTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ ofImage::reloadTexture方法的具体用法?C++ ofImage::reloadTexture怎么用?C++ ofImage::reloadTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofImage
的用法示例。
在下文中一共展示了ofImage::reloadTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
//--------------------------------------------------------------
void ofApp::draw(){
//Merci Ludo pour ton aide
currentFrame = vidGrabber.getPixelsRef();
currentFrameCopy.allocate(currentFrame.getWidth(), currentFrame.getHeight(), OF_IMAGE_GRAYSCALE);
for(int x=0 ; x < 256 ; x++) {
histogram[x] = 0;
}
for (int i = 0; i < camWidth; i++){
for (int j = 0; j < camHeight; j++){
int lightness = currentFrame.getColor(i,j).getLightness();
histogram[lightness] = histogram[lightness]+1;
ofColor pixel;
pixel.set(lightness, lightness, lightness);
currentFrame.setColor(i, j, pixel);
}
}
ofSetHexColor(0xffffff);
currentFrame.reloadTexture();
currentFrame.draw(0,0);
ofFill();
ofSetHexColor(0x000000);
ofSetPolyMode(OF_POLY_WINDING_ODD);
ofLine(770, 400, 770, 400-255);
ofLine(770, 400, 770+255, 400);
histogramMax = 0;
maxIndex = 0;
for(int x = 0 ; x < 256 ; x++) {
if (histogram[x]>histogramMax) {
histogramMax = histogram[x];
maxIndex = x;
}
histogram[x] = histogram[x]/100;
//cout << x << " : " << histogram[x] << "\n";
ofLine(x+770, 400-histogram[x], x+770, 400);
}
ofSetColor(255,0,0);
ofLine(maxIndex+770, 400-histogram[maxIndex], maxIndex+770, 400);
ofSetColor(0);
ofDrawBitmapString("Histogram : ", 770, 100);
ofDrawBitmapString("0 255 ", 770, 415);
ofDrawBitmapString("0", 755, 400);
ofDrawBitmapString("???", 773, 150);
threshold = 128;
for(int y = 0; y < camHeight; y++) {
for(int x = 0; x < camWidth; x++) {
ofColor cur = currentFrame.getColor(x, y);
int lightness = cur.getLightness();
ofColor pixel;
if (lightness<threshold) pixel.set(0, 0, 0);
else pixel.set(255, 255, 255);
currentFrameCopy.setColor(x, y, pixel);
}
}
ofSetColor(255);
currentFrameCopy.reloadTexture();
currentFrameCopy.draw(0, 480);
}