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


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

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


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

示例1: drawPupilImageWithScanLine

void thresholdCalculator::drawPupilImageWithScanLine(int x, int y, int w, int h, ofxCvGrayscaleImage & img) {
	
	ofEnableAlphaBlending();
	
	ofPushMatrix();
	ofTranslate(x, y, 0);
	
	ofSetColor(255, 255, 255);
	img.draw(0, 0, w, h);
	
	ofSetColor(255, 255, 255,80);
	ofLine(0, scanY, w, scanY);				
	ofLine(scanX, 0, scanX, h);
	
	ofSetColor(255, 0, 0, 50);
	ofFill();
	ofCircle(whiteLocMin.x * (img.width / roi.width), whiteLocMin.y * (img.height / roi.height), 10);
	
	ofDisableAlphaBlending();
	
	ofSetColor(255, 255, 255);
	ofDrawBitmapString("imgBeforeThreshold", 1, h + 12);
	
	ofPopMatrix();
	
}
开发者ID:BluntBlade,项目名称:eyewriter,代码行数:26,代码来源:thresholdCalculator.cpp

示例2: draw

    void draw(){
//        sampleImg.draw(0, 0, 450, 450);
        
        cannyImg.draw(0, 0, 450, 450);
        cannyInvertImg.draw(450, 0, 450, 450);
        
    }
开发者ID:jeonghopark,项目名称:simpleOpenCV,代码行数:7,代码来源:main.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


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