• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ofVideoPlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getStartAndEndTimes

ofRange ofxRGBDVideoDepthSequence::getStartAndEndTimes(ofVideoPlayer& player, ofxDepthImageSequence& sequence){
    if(!ready()){
        ofLogError("ofxRGBDVideoDepthSequence::getStartAndEndTimes -- video sequence not ready");
        return ofRange();
    }
    ofRange output;
    output.min = MAX(0, getVideoMillisForDepthMillis(0))/1000.;
    output.max = MIN(player.getDuration(), getVideoMillisForDepthMillis(sequence.getDurationInMillis()) / 1000. );
	return output;
}
开发者ID:Saihsq,项目名称:ofxRGBDepth,代码行数:10,代码来源:ofxRGBDVideoDepthSequence.cpp


示例2: draw

//--------------------------
//void ofxQuad::draw(ofTexture image,int sx,int sy,int sw,int sh){
  void ofxQuad::draw(ofVideoPlayer image,int sx,int sy,int sw,int sh,int num){
      
   //   ofSetColor(255, 255, 255);
    if(moveall == 1){
      if(quadMesh.getNumVertices() < 4){
          quadMesh.draw();
        }
            }
      ofTexture bb;
      bb = image.getTextureReference();
      ofPushMatrix();

    // find transformation matrix
    findHomography(src, dst, matrix);
    
    //finally lets multiply our matrix
   glMultMatrixf(matrix);
      

    bb.drawSubsection(0,0,w,h,sx,sy,sw,sh);
    if(debug){
      
        if(active){
              ofSetColor(redColour, 255, 0,255);
        }
        else{
            ofSetColor(255, 255, 255,255); 
        }
   // ofDrawBitmapString(ofToString(num), sw,sy);
    ofRect(0,0,w,h);
        

 //   verdana30.drawString(ofToString(num), sx,sh+sh);
    
         ofSetColor(0, 0, 0);
    }

    ofPopMatrix();

      if(debug){
          ofPushStyle();
          ofSetColor(255, 255, 255);
          ofSetLineWidth(4);
          ofLine(0, ofGetMouseY(), ofGetWidth(), ofGetMouseY());
          ofLine(ofGetMouseX(), 0, ofGetMouseX(), ofGetHeight());
          ofPopStyle();
      }
}
开发者ID:strimbob,项目名称:ofxQuad,代码行数:50,代码来源:ofxQuad.cpp


示例3: update

void ofxOpticalFlowLK :: update ( ofVideoPlayer& source )
{
	update( source.getPixels(), source.width, source.height, OF_IMAGE_COLOR );	// assume colour image type.
}
开发者ID:MaxWorgan,项目名称:ofxOpticalFlowLK,代码行数:4,代码来源:ofxOpticalFlowLK.cpp


示例4: 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);
}
开发者ID:essteban,项目名称:ofxImageTS,代码行数:6,代码来源:ofxImageTS.cpp


示例5: setTexture

//--------------------------------------------------------------
void VisualRingBuffer::setTexture(ofVideoPlayer player){
    begin();
    player.draw(0, 0, width, height);
    end();
}
开发者ID:JoshuaBatty,项目名称:ofxPlaymodes,代码行数:6,代码来源:VisualRingBuffer.cpp


示例6: update

void ofxOpticalFlowFarneback::update(ofVideoPlayer& source) {
    update(source.getPixels().getData(), source.getWidth(), source.getHeight(), OF_IMAGE_COLOR); // assume colour image type.
}
开发者ID:ofZach,项目名称:funkyForms,代码行数:3,代码来源:ofxOpticalFlowFarneback.cpp


示例7: update

void TTimbre::update(ofVideoPlayer input){
	originalImage.setFromPixels(input.getPixels(), input.getWidth(),  input.getHeight(), OF_IMAGE_COLOR);
	internalUpdate();
}
开发者ID:paulobarcelos,项目名称:Timbre,代码行数:4,代码来源:TTimbre.cpp


示例8: 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();
			}		

		}
	}
}
开发者ID:Giladx,项目名称:autoMovie,代码行数:47,代码来源:testApp.cpp


示例9: mouseDragged

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
	if(mode == "full" && bDown){
		thumbs[selected].pos = ofMap(x, 0, ofGetWidth(), 0, 0.9999, true);
		fullVid.setPosition(thumbs[selected].pos);
		fullVid.update();		
	}
	else if( mode == "move" && bDown ){

		for(int i = 0; i < thumbs.size(); i++){
			ofRectangle tr = thumbs[i].r;
			if( tr.inside(x,y) ){
				placedIndex = i;
				cout << "placedIndex " << placedIndex <<endl;
			}
		}

	}
}
开发者ID:Giladx,项目名称:autoMovie,代码行数:19,代码来源:testApp.cpp


示例10: mouseReleased

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
	if(mode == "full" && bDown){
		thumbs[selected].pos = ofMap(x, 0, ofGetWidth(), 0, 0.9999, true);
		thumbs[selected].savePos();
		fullVid.setPosition(thumbs[selected].pos);
		fullVid.update();
		fullVid.setPaused(false);		
		fullVid.play();
		timer = ofGetElapsedTimef() + NUM_SECS;		
	}
	
	if( mode == "move" ){
		if( bDown ){
			reorganizeThumbs();
		}
	}
	bDown = false;
}
开发者ID:Giladx,项目名称:autoMovie,代码行数:19,代码来源:testApp.cpp


示例11: nextVideo

void nextVideo(){
	if( whichVideo < thumbs.size() ){
		
		vid.loadMovie(thumbs[whichVideo].video);
		vid.play();
		vid.update();
		vid.setPosition(thumbs[whichVideo].pos);
		
		if( mode == "play" ){
			vid.setSpeed(0.25);
		}
		
		whichVideo++;
		framecounter = 0;
	}else{
		std::exit(0);
	}
}
开发者ID:Giladx,项目名称:autoMovie,代码行数:18,代码来源:testApp.cpp


示例12: update

//--------------------------------------------------------------
void ofApp::update(){
//-------------------------
    
    bool bNewFrame = false;
    vidGrabber.update();
    bNewFrame = vidGrabber.isFrameNew();
    if (bNewFrame){  // if we have a new frame
        colorImg.setFromPixels(vidGrabber.getPixels());
        grayImage = colorImg;
        if (bLearnBakground == true){  // if we hit space, this grabs a "control" image
            grayBg = grayImage;		// copys the pixels from grayImage into grayBg
            bLearnBakground = false;
        }
        grayDiff.absDiff(grayBg, grayImage);
        grayDiff.threshold(threshold);
        // find contours which are between the size of 20 pixels and 1/3 the w*h pixels.
        // find max 10 blobs with no holes in them
        contourFinder.findContours(grayDiff, 20, (vidX*vidY)/3, 10, false);	// false == dont find holes in our blobs
    }
    
    if (bSendSerialMessage){
        serial.writeByte('a');
        nTimesRead = 0;
        nBytesRead = 0;
        int nRead;
        
        unsigned char bytesReturned[3];
        
        memset(bytesReadString, 0, 4);
        memset(bytesReturned, 0, 3);
        
        while( (nRead = serial.readBytes( bytesReturned, 3)) > 0){
            nTimesRead++;
            nBytesRead = nRead;
        };
        
        memcpy(bytesReadString, bytesReturned, 3);
        
        bSendSerialMessage = false;
        readTime = ofGetElapsedTimef();
    }
    
    mov1.update();
    
    for(unsigned int i = 0; i < p.size(); i++){
        p[i].setMode(currentMode);
        p[i].update();
    }
    for(unsigned int i = 0; i < attractPointsWithMovement.size(); i++){
        attractPointsWithMovement[i].x = attractPoints[i].x + ofSignedNoise(i * 10, ofGetElapsedTimef() * 0.7) * 12.0;
        attractPointsWithMovement[i].y = attractPoints[i].y + ofSignedNoise(i * -10, ofGetElapsedTimef() * 0.7) * 12.0;
    }
    
}
开发者ID:jessherzog,项目名称:storyEclipse,代码行数:55,代码来源:ofApp.cpp


示例13: setup

//--------------------------------------------------------------
void ofApp::setup(){
  ofSetLogLevel(OF_LOG_NOTICE);

  ofFileDialogResult result = ofSystemLoadDialog("Select movie file...");
  if(result.bSuccess == false){
    ofLogWarning() << "SystemDialog canceled";
    ofExit(1);
  }

  ofSleepMillis(300);
  video.load(result.getPath());
  video.setVolume(0);
  video.setLoopState(OF_LOOP_NONE);

  // WORKAROUND
  video.play();
  video.stop();

  windowRefresh(ofGetWindowWidth(), ofGetWindowHeight());
}
开发者ID:atmarksharp,项目名称:VideoFrameExporter,代码行数:21,代码来源:ofApp.cpp


示例14: 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);
    }
开发者ID:GlocalSound,项目名称:Transcranial,代码行数:27,代码来源:main.cpp


示例15: keyPressed

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
  ofLogVerbose() << "ON : key " << key;

  // [space]: toggle pause and resume
  if(key == 32){
    if(video.isPlaying()){
      bool paused = video.isPaused();

      const char* status = (!paused)? "[pause]": "[resume]";
      ofLogNotice() << "Video: " << status;

      video.setPaused(!paused);
    }else{
      ofLogNotice() << "Video: [play]";
      video.play();
    }
  // [e] or [s]: save frame
  }else if(key == 101 || key == 115){
    string path = currentDateWithCount() + ".png";
    ofPixels* pix = new ofPixels();

    video.setPaused(true);
    pix->setFromPixels(video.getPixels(), vw, vh, OF_IMAGE_COLOR);
    ofSaveImage(*pix, path, OF_IMAGE_QUALITY_MEDIUM);

    ofLogWarning() << "\nSaved frame to \"" << path << "\"" << endl;

  // left key: forward
  }else if(key == 356){
    vVector = 1.0;
    applyVideoMatrix();
  // right key: backward
  }else if(key == 358){
    vVector = -1.0;
    applyVideoMatrix();

  // [0]: very slow speed
  }else if(key == 48){
    vSpeed = 0.25;
    applyVideoMatrix();
  // [1]: normal speed
  }else if(key == 49){
    vSpeed = 1.0;
    applyVideoMatrix();
  // [2]: fast speed
  }else if(key == 50){
    vSpeed = 2.0;
    applyVideoMatrix();
  // [9]: slow speed
}else if(key == 57){
    vSpeed = 0.5;
    applyVideoMatrix();
  }
}
开发者ID:atmarksharp,项目名称:VideoFrameExporter,代码行数:55,代码来源:ofApp.cpp


示例16: update

 void update(){
     ofSetWindowTitle(ofToString(ofGetFrameRate()));
     player.update();
 }
开发者ID:ReallyRad,项目名称:WaterColor,代码行数:4,代码来源:main.cpp


示例17: draw

//--------------------------------------------------------------
void ofApp::draw(){
  ofPushMatrix();
  ofScale(vsr,vsr);
  video.draw(0,0);
  ofPopMatrix();
}
开发者ID:atmarksharp,项目名称:VideoFrameExporter,代码行数:7,代码来源:ofApp.cpp


示例18: exit

    void exit() {
#ifdef USE_EDSDK
        video.close();
#endif
    }
开发者ID:GlocalSound,项目名称:Transcranial,代码行数:5,代码来源:main.cpp


示例19: update

//--------------------------------------------------------------
void ofApp::update(){
  video.update();
}
开发者ID:atmarksharp,项目名称:VideoFrameExporter,代码行数:4,代码来源:ofApp.cpp


示例20: mouseDragged

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
  ofLogNotice() << "Position: " << x/w << "";
  video.setPosition(x / w);
}
开发者ID:atmarksharp,项目名称:VideoFrameExporter,代码行数:5,代码来源:ofApp.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ofXml类代码示例发布时间:2022-05-31
下一篇:
C++ ofVideoGrabber类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap