本文整理汇总了C++中ofFbo::isAllocated方法的典型用法代码示例。如果您正苦于以下问题:C++ ofFbo::isAllocated方法的具体用法?C++ ofFbo::isAllocated怎么用?C++ ofFbo::isAllocated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofFbo
的用法示例。
在下文中一共展示了ofFbo::isAllocated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupedFbo
void setupedFbo()
{
if (!mFbo.isAllocated()) {
mFbo.allocate(getWidth(), getHeight(), GL_RGBA);
mGlitch.setup(&mFbo);
mGlitch.setFx(OFXPOSTGLITCH_TWIST, true);
}
}
示例2: update
//--------------------------------------------------------------
void testApp::update(){
// Get infrarred image from kinect and transform to OpenCV image
recordContext.update();
recordImage.update();
grayImage.setFromPixels(recordImage.ir_pixels, W, H);
// Save background
if(bBackground){
saveBackground();
bBackground = false;
}
// ROI mask selection
drawRoiMask(grayImage);
roi.x = MIN(roiMask[0].x, roiMask[3].x);
roi.y = MIN(roiMask[0].y, roiMask[1].y);
roiW = MAX(roiMask[1].x, roiMask[2].x) - roi.x;
roiH = MAX(roiMask[3].y, roiMask[2].y) - roi.y;
grayImage.setROI(roi.x, roi.y, roiW, roiH);
backImg.setROI(roi.x, roi.y, roiW, roiH);
grayAcc.setROI(roi.x, roi.y, roiW, roiH);
// Opencv preprocessing
t0 = ofGetElapsedTimeMillis();
if(bProcess){
// grayImage.absDiff(grayImage, backImg);
grayImage.brightnessContrast(brightness, contrast);
cvAdaptiveThreshold(grayImage.getCvImage(), grayImage.getCvImage(), 255);
grayImage.blur();
grayImage.erode();
grayImage.dilate();
grayImage.addWeighted(grayAcc, 0.1);
grayAcc = grayImage;
grayImage.canny(50, 150);
Mat dst = grayImage.getCvImage();
findContours(dst, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
for (size_t i = 0; i < contours.size(); i++){
CvPoint* pts = new CvPoint[contours[i].size()];
for(int j = 0; j < contours[i].size(); j ++){
pts[j].x = contours[i][j].x;
pts[j].y = contours[i][j].y;
}
int nPts = contours[i].size();
cvPolyLine( grayImage.getCvImage(), &pts, &nPts, 1, true, CV_RGB(255, 255, 255));
delete[] pts;
}
grayImage.dilate();
grayImage.erode();
}
t1 = ofGetElapsedTimeMillis() - t0;
//---
// Send image to MadMapper
t0 = ofGetElapsedTimeMillis();
tex.allocate(grayImage.getWidth(), grayImage.getHeight(), GL_LUMINANCE);
tex.loadData(grayImage.getPixels(), grayImage.getWidth(), grayImage.getHeight(), GL_LUMINANCE);
individualTextureSyphonServer.publishTexture(&tex);
//---
// Get image from MadMapper
if(!fbo.isAllocated() || !(mClient.getWidth() == fbo.getWidth() && mClient.getHeight() == fbo.getHeight()))
fbo.allocate(mClient.getWidth(), mClient.getHeight());
fbo.begin();
mClient.draw(0, 0);
fbo.end();
fbo.readToPixels(pix);
t2 = ofGetElapsedTimeMillis() - t0;
//---
// Update my system
L.update(mouseX, mouseY);
}