NVIDIA DeepStream SDK API Reference

6.4 Release
image_meta_producer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #pragma once
24 
25 #include <sstream>
26 #include <iomanip>
27 #include <fstream>
28 #include <chrono>
29 #include <ctime>
30 #include "image_meta_consumer.h"
31 #include "concurrent_queue.h"
32 
34 {
35 public:
36  // left: filepath for multiple file, right: file content
37  typedef std::pair<std::string, std::string> string_pair;
39  struct IPData
40  {
41  float confidence = 0.f;
43  unsigned class_id = 0;
44  unsigned current_frame = 0;
45  unsigned video_stream_nb = 0;
46  std::string class_name;
47  std::string video_path;
50  std::string datetime;
51  unsigned img_height = 0;
52  unsigned img_width = 0;
53  unsigned img_top = 0;
54  unsigned img_left = 0;
55  };
56 
61  bool stack_obj_data(IPData &data);
66  void generate_image_full_frame_path(const unsigned stream_source_id,
67  const std::string &datetime_iso8601);
69  std::string get_image_full_frame_path_saved();
70 
71 private:
72 
74  std::string make_csv_data(const IPData &data);
76  std::string make_json_data(const IPData &data);
78  std::string make_kitti_data(const IPData &data);
80  std::string make_kitti_save_path() const;
81 
82  std::string image_full_frame_path_saved_;
83  std::vector<std::string> obj_data_csv_;
84  std::vector<std::string> obj_data_json_;
85  std::vector<std::string> obj_data_kitti_;
86  ImageMetaConsumer &ic_;
87 };
ImageMetaProducer::IPData::img_height
unsigned img_height
Definition: image_meta_producer.h:51
ImageMetaProducer::IPData::within_confidence
bool within_confidence
Definition: image_meta_producer.h:42
ImageMetaProducer::IPData
Content that will converted to string and sent to consumer.
Definition: image_meta_producer.h:39
ImageMetaProducer::IPData::video_path
std::string video_path
Definition: image_meta_producer.h:47
ImageMetaProducer::IPData::confidence
float confidence
Definition: image_meta_producer.h:41
ImageMetaProducer::string_pair
std::pair< std::string, std::string > string_pair
Definition: image_meta_producer.h:37
ImageMetaProducer::get_image_full_frame_path_saved
std::string get_image_full_frame_path_saved()
Returns locally stored path to complete image.
ImageMetaProducer::ImageMetaProducer
ImageMetaProducer(ImageMetaConsumer &ic)
Constructor registering a consumer.
ImageMetaProducer::IPData::img_width
unsigned img_width
Definition: image_meta_producer.h:52
ImageMetaConsumer
Definition: image_meta_consumer.h:46
image_meta_consumer.h
ImageMetaProducer::IPData::image_full_frame_path_saved
std::string image_full_frame_path_saved
Definition: image_meta_producer.h:48
ImageMetaProducer::IPData::img_left
unsigned img_left
Definition: image_meta_producer.h:54
ImageMetaProducer::IPData::datetime
std::string datetime
Definition: image_meta_producer.h:50
ImageMetaProducer::stack_obj_data
bool stack_obj_data(IPData &data)
store metadata information locally before send it.
ImageMetaProducer::IPData::image_cropped_obj_path_saved
std::string image_cropped_obj_path_saved
Definition: image_meta_producer.h:49
ImageMetaProducer::IPData::current_frame
unsigned current_frame
Definition: image_meta_producer.h:44
ImageMetaProducer::IPData::img_top
unsigned img_top
Definition: image_meta_producer.h:53
ImageMetaProducer::IPData::video_stream_nb
unsigned video_stream_nb
Definition: image_meta_producer.h:45
ImageMetaProducer::IPData::class_id
unsigned class_id
Definition: image_meta_producer.h:43
ImageMetaProducer::send_and_flush_obj_data
void send_and_flush_obj_data()
send metadata stored (after some processing for KITTI type).
ImageMetaProducer
Definition: image_meta_producer.h:33
ImageMetaProducer::generate_image_full_frame_path
void generate_image_full_frame_path(const unsigned stream_source_id, const std::string &datetime_iso8601)
Create and store locally a path to a complete image.
ImageMetaProducer::IPData::class_name
std::string class_name
Definition: image_meta_producer.h:46
concurrent_queue.h