当前位置: 首页>>代码示例>>C++>>正文


C++ ofxCvColorImage::draw方法代码示例

本文整理汇总了C++中ofxCvColorImage::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxCvColorImage::draw方法的具体用法?C++ ofxCvColorImage::draw怎么用?C++ ofxCvColorImage::draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ofxCvColorImage的用法示例。


在下文中一共展示了ofxCvColorImage::draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

//--------------------------------------------------------------
void testApp::draw(){
    ofSetColor(255, 255, 255);
    colorImg.draw(0, 0, ofGetWidth(), ofGetHeight());
    
    glPushMatrix();
    glScalef(ofGetWidth() / (float)greyImageSmall.getWidth(), ofGetHeight() / (float)greyImageSmall.getHeight(), 1);
//    haarTracker.draw(0, 0);
    ofNoFill();
	for(int i = 0; i < haarFinder.blobs.size(); i++) {
		ofRectangle cur = haarFinder.blobs[i].boundingRect;
//		ofRect(cur.x, cur.y, cur.width, cur.height);
        int iw = cur.width * 1.4;
        img.draw(haarFinder.blobs[i].centroid, iw, iw * img.getHeight() / img.getWidth());
	}

    glPopMatrix();
}
开发者ID:bmwcmw,项目名称:iSteveJobs,代码行数:18,代码来源:testApp.cpp

示例2: draw

void ofApp::draw() {
    
    ofBackground(0.0, 0.0, 0.0);
    
    ofSetColor(255.0,255.0,255.0);
    ofFill();
    for (int i = 0; i < 10; i++) {
        ofDrawBitmapString(verbalInstructions[i], 10, (i*20)+600);
    }
    
    if (cameraInfoIsOn) {
        ofSetColor(255.0, 255.0, 255.0);
        ofFill();
        
        /* drawing cameras */
        ofSetColor(255.0,0.0,0.0);
        ofDrawBitmapString("Active column", 10, 30+10);
        ofSetColor(0.0,0.0,255.0);
        ofDrawBitmapString("Active camera #", 10, 50+10);
        ofSetColor(255,105,180);
        ofDrawBitmapString("# of Pedestrians", 10, 60+20);
        ofSetColor(255.0, 255.0, 255.0);
        int cnt = 0;
        for (int i = 300-70; i <= 300+700; i+=70) {
            if (cnt == 4 || cnt == 5 ) {
                ofSetColor(cameraColor1);
                ofDrawBitmapString("["+ofToString(cnt+1)+"]", i+22, 50+10);
                ofSetColor(255,105,180);
                ofDrawBitmapString((int)micLevelsTopNew[cnt], i+35, 60+10);
                cout << i+35 << endl;
                ofSetColor(255.0, 255.0, 255.0);
            } else {
                if (simulationIsOn) {
                    ofSetColor(255,105,180);
                } else {
                    ofSetColor(100,100,100);
                }
                ofDrawBitmapString((int)micLevelsTopNew[cnt], i+35, 60+10);
                cout << i+35 << endl;
                ofSetColor(255.0, 255.0, 255.0);
                ofDrawBitmapString("["+ofToString(cnt+1)+"]", i+22, 50+10);
            }
            cnt++;
        }
        cout << "" << endl;
        
        /* Draw Columns */
        cnt = 0;
        ofFill();
        ofSetColor(100.0, 100.0, 100.0);
        for (int i = 300; i <= 300+700; i+=70) {
            if (cnt == 4) {
                ofSetColor(columnColor);
                ofDrawCircle(i, 45, 7);
                ofSetColor(100.0, 100.0, 100.0);
            } else {
                ofDrawCircle(i, 45, 7);
            }
            cnt++;
        }
        int max_pos = 0;
        int max_element = -1000;
        for (int i = 0; i < 12; i++) {
            if (micLevelsTopNew[i] > max_element) {
                max_pos = i;
                max_element = micLevelsTopNew[i];
            }
        }
        //ofVec2f btm = absColumnPositionTop[max_pos];
        ofVec2f btm = cameraPositionsTop[max_pos];
        ofVec2f desired =  btm - swarmPosition;
        float d = sqrt((desired.x*desired.x) + (desired.y+desired.y));
        float r = ofMap(ofClamp(d, 0.0, 700.0), 0.0, 700.0, 25.0, 76.5);
        ofColor swarmColor = ofColor(255.0, 0.0, 255.0);
        ofSetColor(swarmColor);
        ofDrawRectangle(swarmPosition.x, 45, 10, 50);
        ofSetColor(columnColor);
        ofFill();
        ofDrawCircle(578, 270, 14);
    
        
        for (int i = 0; i < contourFinder.nBlobs; i++){
            contourFinder.blobs[i].draw(238, 150);
            
            ofSetColor(255);
            if(contourFinder.blobs[i].hole){
                ofDrawBitmapString("hole",
                                   contourFinder.blobs[i].boundingRect.getCenter().x + 360,
                                   contourFinder.blobs[i].boundingRect.getCenter().y + 540);
            }
        }
        ofNoFill();
        ofSetColor(cameraColor1);
        ofDrawBitmapString("Camera 5", 238, 140);
        ofDrawRectangle(238, 150, 340, 240);
        ofSetColor(255,255,255,50.0);
        colorImg.draw(238, 150);

        
        for (int i = 0; i < contourFinder1.nBlobs; i++){
//.........这里部分代码省略.........
开发者ID:Future-Cities-Lab,项目名称:DCOpenFrameworks,代码行数:101,代码来源:ofApp.cpp

示例3: draw

void draw() 
{
    ofSetColor(255);

    // A few helper variables for layout.
    int hw = width / 2;  // Half width
    int hh = height / 2; // Half height.
    int qw = width / 4;  // Quarter width.
    int qh = height / 4; // Quarter height.
    int lx = 14; // Label offset x.
    int ly = 20; // Label offset y.

    grayscaleImage.draw(0, 0, qw, qh);
    ofDrawBitmapStringHighlight("0. Grayscale", lx, ly);
    
    grayscaleBackgroundImage.draw(qw, 0, qw, qh);
    ofDrawBitmapStringHighlight("1. Background\n   (spacebar)", lx + qw, ly);


	grayscaleAbsoluteDifference.draw(0, qh, qw, qh);
    ofDrawBitmapStringHighlight("2. Grayscale - Background", lx, ly + qh);


	grayscaleBinary.draw(qw, qh, qw, qh);
    ofDrawBitmapStringHighlight("3. Threshold " + ofToString(threshold) + "\n   (-/+: change threshold)\n   (  i: invert)", lx + qw, ly + qh);

    // Here we use ofPushMatrix(), ... to scale all of the contours and bounding boxes.
    ofPushStyle();
    ofPushMatrix();
    ofTranslate(hw, 0);
    ofScale(0.5, 0.5, 1);
    grayscaleBinary.draw(0, 0);
    contourFinder.draw(); // Draw all of the contours and their bounding boxes. 
    
    // Draw our line.
    ofSetColor(ofColor::yellow);
    holePositions.draw();
    ofPopMatrix();
    ofDrawBitmapStringHighlight("4. Contours and Bounding Boxes\n   Draw a yellow line to follow\n   the center of the largest blob.", lx + hw, ly);
    ofPopStyle();
  
    colorImage.draw(0, 0);//, hw, hh);
    // ofDrawBitmapStringHighlight("5. Original", lx, ly + hh);
    
    for (int i = 0; i < contourFinder.nBlobs; ++i)
    {
        ofPolyline contour(contourFinder.blobs[i].pts);
        
        // Resample to reduce the resolution.
        contour = contour.getResampledBySpacing(5);
        
        float interpolatedIndex = offset * contour.size();
        
        ofPoint position = contour.getPointAtIndexInterpolated(interpolatedIndex); 
        ofPoint normal = contour.getNormalAtIndexInterpolated(interpolatedIndex); 
        
        // Make a line pointing normal to the contour.
        ofPoint lineEnd = position - normal * 30;
        
        ofSetColor(ofColor::yellow);
        contour.draw();
            
        ofLine(position, lineEnd);
        ofCircle(lineEnd, 2);
        
    }
    
    
}
开发者ID:SAIC-ATS,项目名称:ARTTECH-5010,代码行数:69,代码来源:main.cpp


注:本文中的ofxCvColorImage::draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。