Hello guys,
i am currently working on a semester project to track cars and bicycles and measure the distance between the two by using the xyz coordinates of the detected objects.
Now i want to create a list with all the the detected objects with their respective data like xyz values, velocity, id etc. to store them permenantly outside of the svo file. Is there a way to create a list with all the objects? I know that the date of the object list is stored in a vector but i cant figure out to make a proper list.
The plan is to store all the data and potentially teach an AI to seperate cars and bicycles better and to write an algorithm which automatically detects a “take over maneuver” of said objects.
Thank you for your help!
Myzhar
September 21, 2023, 1:44pm
2
Hi @sebbijay
Welcome to the Stereolabs community.
You can simply create a CSV file frame-by-frame with all the information you need to save.
Thanks for the reply!
I tried the GStreamer but i cant get the CMake program to compile the gstreamer sample code from GitHub because it cant detect the gstreamer even tho it is installed.
I am mainly working with the “birds eye viewer” example und just need to get the data of the detectep objects into the csv file but i sadly couldn’t figure it out.
Myzhar
September 25, 2023, 12:21pm
4
Why GStreamer? It does not allow you to save the detected object information in a CSV file unless you write your own plugin.
What code language are you using?
Ditched the GStreamer. When i googled it together with the ZED 2 it led me to a doc page vom stereolabs explaining CSV files with gstreamer.
I am coding in c++ and trying to implement a csv solution into the bird eye viewer program.
Myzhar
September 27, 2023, 8:26am
6
OK, you can use the code here as an example:
// /////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2020, STEREOLABS.
//
// All rights reserved.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// /////////////////////////////////////////////////////////////////////////
This file has been truncated. show original
We used an output file stream to save CSV line by line (std::ofstream* out_file_ptr;
).
This is the code to save the header:
*sink->out_file_ptr << "TIMESTAMP,STREAM_TYPE,CAM_MODEL,GRAB_W,GRAB_H," <<
"POSE_VAL,POS_TRK_STATE,POS_X_[m],POS_Y_[m],POS_Z_[m],OR_X_[rad],OR_Y_[rad],OR_Z_[rad]," <<
"IMU_VAL,ACC_X_[m/s²],ACC_Y_[m/s²],ACC_Z_[m/s²],GYRO_X_[rad/s],GYROY_[rad/s],GYRO_Z_[rad/s]," <<
"MAG_VAL,MAG_X_[uT],MAG_Y_[uT],MAG_Z_[uT]," <<
"ENV_VAL,TEMP_[°C],PRESS_[hPa]," <<
"TEMP_VAL,TEMP_L_[°C],TEMP_R_[°C]" <<
std::endl;
and here you save all the information (IMU data in this case) line by line:
// ----> Timestamp
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buf);
*csvsink->out_file_ptr << timestamp << CSV_SEP;
// <--- Timestamp
GST_TRACE_OBJECT( csvsink, "Input buffer size %lu B", map_in.size );
GST_TRACE_OBJECT( csvsink, "GstZedSrcMeta size %lu B", sizeof(GstZedSrcMeta) );
GstZedSrcMeta* meta = (GstZedSrcMeta*)map_in.data;
// ----> Info
*csvsink->out_file_ptr << meta->info.stream_type << CSV_SEP;
*csvsink->out_file_ptr << meta->info.cam_model << CSV_SEP;
*csvsink->out_file_ptr << meta->info.grab_single_frame_width << CSV_SEP;
*csvsink->out_file_ptr << meta->info.grab_single_frame_height << CSV_SEP;
GST_LOG (" * [META] Stream type: %d", meta->info.stream_type );
GST_LOG (" * [META] Camera model: %d", meta->info.cam_model );
GST_LOG (" * [META] Grab frame size: %d x %d", meta->info.grab_single_frame_width, meta->info.grab_single_frame_height );
// <---- Info
This file has been truncated. show original