Skip to content

rs-convert converts frames using sensor callback - #6308

Merged
dorodnic merged 7 commits into
realsenseai:developmentfrom
aseelegbaria:convert
May 20, 2020
Merged

rs-convert converts frames using sensor callback#6308
dorodnic merged 7 commits into
realsenseai:developmentfrom
aseelegbaria:convert

Conversation

@aseelegbaria

Copy link
Copy Markdown
Contributor
  1. the tool now names frames based on frame timestamp (instead of frame number)
  2. the tool creates metadata text file for the frame
  3. the tool converts frames by running over sensors and using sensor callback (instead of wait_for_frames), for ply converter it still uses wait_for_frames since we need synced frames

@aseelegbaria
aseelegbaria changed the base branch from master to development April 27, 2020 10:14
@maloel
maloel self-requested a review May 2, 2020 07:15
if (frames_map_get_and_set(frame.get_profile().stream_type(), frame.get_frame_number())) {
continue;
}
if (depthframe && (_streamType == rs2_stream::RS2_STREAM_ANY || depthframe.get_profile().stream_type() == _streamType)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this outside the worker? So the thread won't even start of not the right frame/stream?

if (fs) {
uint8_t buffer[4];
add_sub_worker(
[filenameS, depthframe] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation seems off here -- please check

}
}
});
std::stringstream metadata_file;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the frame written from a sub_worker but the metadata from here?

for (size_t i = 0; i < frameset.size(); i++) {
auto frame = frameset[i].as<rs2::depth_frame>();
[this, &frame] {
auto depthframe = frame.as<rs2::depth_frame>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check indent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same comments here and the other convert hpp files as above)

Comment thread tools/convert/rs-convert.cpp Outdated
cout << posP << "%" << "\r" << flush;
}

auto plyconverter = make_shared<rs2::tools::converter::converter_ply>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to allocate anything until we check that filename is set


rs2::frameset frameset;
auto frameNumber = 0ULL;
std::mutex mutex;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the mutex needed?

Comment thread tools/convert/rs-convert.cpp
Comment thread tools/convert/rs-convert.cpp Outdated
playback.set_real_time(false);
std::vector<rs2::sensor> sensors = playback.query_sensors();

rs2::frameset frameset;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need 'frameset'

Comment thread tools/convert/converter.hpp Outdated
// Record all the available metadata attributes
for (size_t i = 0; i < RS2_FRAME_METADATA_COUNT; i++)
{
if (frm.supports_frame_metadata((rs2_frame_metadata_value)i))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make i of type rs2_frame_metadata_value?

@dorodnic
dorodnic merged commit a10db1d into realsenseai:development May 20, 2020
@aseelegbaria
aseelegbaria deleted the convert branch May 2, 2021 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants