The quickest recording of a range of events
Hello Prophesee Team,
I want to write some amounts of events (200ms, several pipeline slices) before a dynamically calculated point in time. I am always saving last 5 pointers of event buffers to deque, and use it to write events when I need it.
WriteCSV() works, but I want to do that quicker, so I tried to write in the .RAW file, and have problems with the WriteRAW().
The .raw file is created, but it is not loaded in the Metavision studio,
metavision_file_to_dat.exe has many NonMonotonicTimeHigh and InvalidVectBase errors.
and the metavision_evt2_raw_file_decoder.exe and metavision_evt3_raw_file_decoder.exe both create the output file with garbage values.
- ofs.write(reinterpret_cast<char*>(buffer->data()), size * sizeof(Metavision::I_EventsStream::RawData));
Do you see any problems in this code:
- EventsWriter::EventsWriter(Metavision::Camera& camera)
- {
- header = camera.get_device().get_facility<Metavision::I_HW_Identification>()->get_header();
- header.add_date();
- }
- bool EventsWriter::AddSlice(EventBufferPtr buffer)
- {
- buffers_deque.push_back(buffer);
- if (buffers_deque.size() > buffers_amount)
- buffers_deque.pop_front();
- return true;
- }
- bool EventsWriter::WriteCSV()
- {
- if (!buffers_deque.empty())
- {
- auto start = buffers_deque.front()->front().t;
- auto end = buffers_deque.back()->back().t;
- std::ostringstream ss;
- for (auto& buffer : buffers_deque)
- for (auto& evt : *buffer)
- ss << evt.t << "," << evt.x << "," << evt.y << "," << evt.p << "\n";
- std::stringstream filename;
- filename << start << "-" << end << ".csv";
- std::ofstream ofs(filename.str());
- ofs << ss.str();
- }
- return true;
- }
- bool EventsWriter::WriteRAW()
- {
- if (!buffers_deque.empty())
- {
- auto start = buffers_deque.front()->front().t;
- auto end = buffers_deque.back()->back().t;
- std::stringstream filename;
- filename << start << "-" << end << ".raw";
- std::ofstream ofs(filename.str());
- ofs << header;
- for (auto& buffer : buffers_deque)
- {
- auto size = buffer->size();
- ofs.write(reinterpret_cast<char*>(buffer->data()), size * sizeof(Metavision::I_EventsStream::RawData));
- }
- ofs.close();
- ofs.clear();
- }
- return true;
- }
Information
In this Community Forum, you can discuss products, technology and applications. Only registred users can post but everyone can read. To ask a private question, enter a support ticket in My Area
https://support.prophesee.ai/portal/en/newticket