Browse Source

check if frame is equal to seek!

tsns-map
cailean 5 months ago
parent
commit
abbc55cded
  1. 8
      src/Player.cpp
  2. 3
      src/ofApp.cpp

8
src/Player.cpp

@ -33,6 +33,7 @@ void Player::Update(ofImage &img, bool show_frame){
if(videoPlayer.isLoaded() && !show_frame){ if(videoPlayer.isLoaded() && !show_frame){
hasVideo = true; hasVideo = true;
playerCurrentFrame = videoPlayer.getCurrentFrame(); playerCurrentFrame = videoPlayer.getCurrentFrame();
std::cout << playerCurrentFrame << std::endl;
videoPlayer.update(); videoPlayer.update();
aspect_ratio = videoPlayer.getWidth() / videoPlayer.getHeight(); aspect_ratio = videoPlayer.getWidth() / videoPlayer.getHeight();
} }
@ -92,7 +93,7 @@ void Player::SetVideoOnAwake(std::string path, ofFbo &fbo){
void Player::SetVideo(std::string path, std::string frame, bool is_active){ void Player::SetVideo(std::string path, std::string frame, bool is_active){
if(path.empty()){ if(path.empty()){
path = "videos/demo.mp4"; path = "videos/output.mp4";
} }
/* convert str frame -> int (remove _x)*/ /* convert str frame -> int (remove _x)*/
@ -113,11 +114,14 @@ void Player::SetVideo(std::string path, std::string frame, bool is_active){
} }
if(set_frame){ if(set_frame){
videoPlayer.setFrame(800); if(videoPlayer.isPlaying() && playerCurrentFrame != f_number){
videoPlayer.setFrame(f_number);
if(playerCurrentFrame == f_number)
set_frame = false; set_frame = false;
} }
} }
} }
}
/* Loads a frame from path */ /* Loads a frame from path */
void Player::SetFrame(std::string path){ void Player::SetFrame(std::string path){

3
src/ofApp.cpp

@ -19,7 +19,7 @@ void ofApp::setup(){
/* setup video */ /* setup video */
player.Setup(); player.Setup();
player.SetVideoOnAwake("videos/demo.mp4", model_output_fbo_1); player.SetVideoOnAwake("dataset/20230601_webexclusi-irelandsey_cl11536538/20230601_webexclusi-irelandsey_cl11536538.mp4", model_output_fbo_1);
player.SetFrame("demo.jpg"); player.SetFrame("demo.jpg");
/* setup models (modelPath, log, useCuda) */ /* setup models (modelPath, log, useCuda) */
@ -205,6 +205,7 @@ void ofApp::renderDepthMap(){
depthToColourShader.setUniform1f("texH", rampedFbo.getHeight()); depthToColourShader.setUniform1f("texH", rampedFbo.getHeight());
screen_fbo.draw(0, 0); screen_fbo.draw(0, 0);
depthToColourShader.end(); depthToColourShader.end();
img.draw(0, 0);
rampedFbo.end(); rampedFbo.end();

Loading…
Cancel
Save