-1

I am trying to run "rs_bag2image" code (https://github.com/UnaNancyOwen/rs_bag2image) for extracting frames from a bag file. I am new in c++ and got the error "failed can't find input bag file" when I am running the code. It seems the issue occurs in the following piece of code. Can you please help me to resolve this issue?

// Retrieve Bag File Path (Required)
    if( !parser.has( "bag") ){
        throw std::runtime_error( "failed can't find input bag 
file");
    }
    else{
        bag_file = parser.get<cv::String>( "bag" ).c_str();
        if( !filesystem::is_regular_file( bag_file ) || 
bag_file.extension() != ".bag" ){
            throw std::runtime_error( "failed can't find input bag 
file" );
        }
    }
zteffi
  • 660
  • 5
  • 18
Ehsan
  • 1
  • 1

1 Answers1

0

You didn't provide path to the bag in the commandline. It says so in the github project's readme. Run the code as

$ ./rs_bag2image -b="./file.bag" -s=true -d=true

If you're running the project inside IDE, find out how to add commandline arguments in the Project's configuration.

zteffi
  • 660
  • 5
  • 18
  • Thanks @zteffi , I Yes I have done in both terminal and IDE as you said, in the terminal I also received this error "rs_bag2image 0.1.3 failed can't find input bag file" – Ehsan Aug 26 '19 at 08:03
  • You need to replace "./file.bag" with path to your bag file – zteffi Aug 26 '19 at 12:11
  • I tried running the code. However, it exits at line `const rs2::playback playback = context.load_device( bag_file.string() );` Any ideas to debug? – DeWil Aug 16 '21 at 09:38