本文整理汇总了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();
}
示例2: draw
void draw(){
// sampleImg.draw(0, 0, 450, 450);
cannyImg.draw(0, 0, 450, 450);
cannyInvertImg.draw(450, 0, 450, 450);
}
示例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);
}
}