本文整理汇总了C++中ofVideoPlayer::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ ofVideoPlayer::getWidth方法的具体用法?C++ ofVideoPlayer::getWidth怎么用?C++ ofVideoPlayer::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofVideoPlayer
的用法示例。
在下文中一共展示了ofVideoPlayer::getWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup() {
ofSetDataPathRoot("../../../../../SharedData/");
ofSetVerticalSync(true);
// ofSetLogLevel(OF_LOG_VERBOSE);
#ifdef USE_VIDEO
video.loadMovie("videos/melica.mp4");
video.play();
#else
video.setup();
#ifdef USE_EDSDK
video.setDeviceType(EDSDK_MKII);
#endif
#endif
ofFbo::Settings settings;
settings.width = video.getWidth();
settings.height = video.getHeight();
settings.useDepth = false;
buffer.allocate(settings);
ofSetBackgroundAuto(false);
contours.getTracker().setPersistence(100);
contours.getTracker().setMaximumDistance(100);
setupGui();
osc.setup("klaus.local", 7400);
}
示例2: windowRefresh
void ofApp::windowRefresh(int w, int h){
// Get sizes
vw = video.getWidth();
vh = video.getHeight();
w = ofGetWindowWidth();
h = ofGetWindowHeight();
// Calculate video scaling rate
if(vh > vw){
vsr = (h / vh) * scaleRate;
}else{
vsr = (w / vw) * scaleRate;
}
}
示例3: pixelate
void ofxImageTS::pixelate(ofVideoPlayer video, int pixelRatio) {
ofPixels R,G,B, copy;
copy.allocate(video.getWidth(), video.getHeight(), OF_PIXELS_RGB);
copy = video.getPixels();
pixelate(copy,pixelRatio);
}
示例4: draw
//--------------------------------------------------------------
void testApp::draw(){
ofBackgroundGradient(ofColor(0,0,0), ofColor(50, 50, 50), OF_GRADIENT_CIRCULAR);
ofSetColor(255);
if( mode == "edit" || mode == "move" ){
if( mode == "move" ){
ofSetColor(20, 90, 30);
ofRect(0,0,3000,3000);
ofSetColor(255);
}
for(int i = 0; i < thumbs.size(); i++){
thumbs[i].draw();
}
if( mode == "move" && bDown ){
ofSetColor(255, 190, 50);
ofRect(thumbs[placedIndex].r.x - 5, thumbs[placedIndex].r.y, 4, 80);
}
ofSetColor(255);
}else if( mode == "full" ){
fullVid.draw(0,0);
ofRect(thumbs[selected].pos * ofGetWidth(), ofGetHeight()-10, 4, 10);
}else{
vid.setAnchorPercent(0.5, 0.5);
vid.draw(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth(), ofGetWidth() * ( vid.getHeight() / vid.getWidth() ));
if( vid.isFrameNew() ){
if( mode == "play" ){
img.grabScreen(0,0,ofGetWidth(),ofGetHeight());
img.saveImage("frames/" + ofToString(totalFrames) + ".jpg");
}
totalFrames++;
framecounter++;
if( framecounter > NUM_FRAMES ){
nextVideo();
}
}
}
}
示例5: update
void TTimbre::update(ofVideoPlayer input){
originalImage.setFromPixels(input.getPixels(), input.getWidth(), input.getHeight(), OF_IMAGE_COLOR);
internalUpdate();
}
示例6: update
void ofxOpticalFlowFarneback::update(ofVideoPlayer& source) {
update(source.getPixels().getData(), source.getWidth(), source.getHeight(), OF_IMAGE_COLOR); // assume colour image type.
}
示例7: draw
void draw() {
ofBackground(0);
ofPushMatrix();
ofPushStyle();
float scaleFactor = ofGetHeight() / (float) MAX(1, video.getHeight());
ofScale(scaleFactor, scaleFactor);
ofTranslate(0, -verticalOffset);
float totalStability = ofClamp(ofMap(smoothedMotionValue, motionMin, motionMax, 0, stability), 0, 1);
int n = contours.size();
for(int i = 0; i < n; i++) {
cv::Rect cur = contours.getBoundingRect(i);
float w = cur.width, h = cur.height;
float sx = cur.x, sy = cur.y;
buffer.begin();
ofDisableBlendMode();
// clear buffer area
ofClear(0, 0);
// draw filled shape (could blur here)
ofPushMatrix();
ofSetColor(255);
ofFill();
ofBeginShape();
vector<cv::Point>& vertices = contours.getContour(i);
for(int j = 0; j < vertices.size(); j++) {
ofVertex(vertices[j].x, vertices[j].y);
}
ofEndShape();
ofPopMatrix();
// draw body image
ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
ofSetColor(255);
video.getTexture().drawSubsection(sx, sy, w, h, sx, sy);
buffer.end();
ofEnableBlendMode(OF_BLENDMODE_ALPHA);
ofPushMatrix();
ofVec2f center = toOf(contours.getCenter(i));
ofVec2f offset = center - bodyCenter;
float orientation = atan2f(offset.y, offset.x);
float spread = totalStability * spreadAmplitude;
ofVec2f position = bodyCenter + offset + ofVec2f(offset.x, 0) * spread;
float id = orientation; //contours.getLabel(i) % 3;
float baseRotation = rotationRate * ofGetElapsedTimef() + id;
float rotation = ofLerp(sin(baseRotation), ofSignedNoise(baseRotation), rotationNoise);
rotation *= rotationAmplitude * totalStability;
float baseScale = scaleRate * ofGetElapsedTimef() + id;
float scale = 1 + scaleAmplitude * ofLerp(sin(baseScale), ofSignedNoise(baseScale), scaleNoise) * totalStability;
ofPushStyle();
ofSetColor(tintRed, tintGreen, tintBlue);
ofTranslate(position);
for(int j = 0; j < repetitionSteps; j++) {
ofPushMatrix();
float rotationAmount = ofMap(j, -1, repetitionSteps, 0, rotation);
ofRotate(rotationAmount);
// ofVec3f axis(0, 0, 1);
// ofRotate(rotationAmount, axis.x, axis.y, axis.z);
float curScale = ofMap(j, -1, repetitionSteps, 1, scale);
ofScale(curScale, curScale, curScale);
buffer.getTextureReference().drawSubsection(-w / 2, -h / 2, 0, w, h, sx, sy);
ofPopMatrix();
}
ofPopStyle();
if(debug) {
ofDrawBitmapStringHighlight(ofToString(contours.getLabel(i)), 0, 0);
}
ofPopMatrix();
}
ofPopStyle();
ofPopMatrix();
ofEnableAlphaBlending();
if(debug) {
ofPushStyle();
ofSetColor(255);
ofNoFill();
ofSetLineWidth(2);
ofDrawRectangle(0, 0, video.getWidth(), video.getHeight());
video.draw(0, 0);
ofPopStyle();
ofPushStyle();
ofEnableBlendMode(OF_BLENDMODE_ADD);
//.........这里部分代码省略.........