-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record 3D image in bag file - several minutes period #3671
Comments
Hi @SamConti Several ways to go about it. The easiest approach is just to create a pipeline, start, stop, delete the pipeline, wait 5 minutes, repeat. Second approach is to use
Benefits are fast response and one single recorded BAG file (unlike other methods) There is another tool that can be useful for your needs:
|
Hello, Thank you for your feedback. I can found this kind of code:
I see the code wait for a frame and save it as image but how in bag file ? |
No worries, int i = 0;
while (true)
{
{ // new scope to force pipeline to be released at the end
rs2::pipeline p;
rs2::config cfg;
std::stringstream ss;
ss << "file_" << i << ".bag";
cfg.enable_record_to_file(ss.str());
p.start(cfg);
p.wait_for_frames();
p.stop();
}
sleep(5000);
i++;
} Check out examples/record-playback for more info |
OK I create the bag file in python, but I have a problem with it.
Is there a way to fix this ? My code is is simply:
EDIT: I found the problem, the script have to be closed from the IDE and bag file are correct. Thank you, |
This looks like the same problem we had here #3044. I haven't found any other solution than to close the IDE like you did. |
Hi, Yes I saw this topic, but solution is for C++ not python. So I get around the problem placing the code to read the camera in a separate *.py file and call it as a thread when needed (not tested as a simple function) = the code is executed, the file is automatically released and the problem doesn't occur. |
Hello, I up this topic because I have a problem I don't know to get around. |
Try import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 6)
config.enable_record_to_file("BagFile.bag")
auto dev = pipe.start(config).get_device().as<rs2::record>();
# Skip first 10 seconds to allow depth to stabilize
dev.pause()
sleep(10000)
dev.resume()
# only record a frame every 5 seconds
while (auto fs = pipe.wait_for_frames())
{
dev.pause();
sleep(5000);
dev.resume();
} |
Hello, There's a syntax error at this line |
Hi SamConti, For getting a recorder device, you may do something like this: profile = pipeline.start(config) Notes: with this, you can skip the line of setting up bag file name "config.enable_record(...)" Thanks! |
Hi, Just thank you. Thanks! |
Hi, my structure is:
and I have the
which to turn off auto exposure priority to record data and my runtime screen is:
and for recording I have:
I'm recording every second one frame on a moving car, road survey. how can I confirm that I got one frame recorded? i also tried the
didn't work either |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
Hello,
I would like to take a 3D image every 5 minutes and store it in a bag file but I don't know how to do this.
The frame format have to be 1280x720 and Z16 format.
At this point I'm able create the basic :
import pyrealsense2 as rs
pipelne = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 6)
pipeline.start(config)
I think I configure with a frame rate of 6 fps...maybe can I set to 1fps and save an image every 300 images ?
About place the image in bag file, I don't know how to do this...
Thanks,
The text was updated successfully, but these errors were encountered: