NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/nv_spot_csvparser.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2018-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
23 #ifndef _NV_SPOT_CSVPARSER_HPP_
24 #define _NV_SPOT_CSVPARSER_HPP_
25 
26 #include <iostream>
27 #include <fstream>
28 #include <map>
29 #include <vector>
30 #include <string>
31 #include <cstdint>
32 
33 using namespace std;
34 
35 namespace nvspot_csv {
38 typedef struct _NvSpotCsvFields
39 {
40  uint32_t cameraId;
41  uint32_t rowId;
42  string cameraIdString;
43  uint32_t surfaceid;
44  uint32_t spot_index;
45  string level;
46  string spotId;
48  double dewarpTopAngle, dewarpBottomAngle, dewarpPitch, dewarpYaw, dewarpRoll;
49  uint32_t vertical_left;
50  uint32_t vertical_right;
52  uint32_t Horizon_x1, Horizon_y1, Horizon_x2, Horizon_y2;
54  uint32_t spot_roi_x1, spot_roi_y1, spot_roi_x2, spot_roi_y2;
55 
57  float x0, y0, x1, y1, x2, y2, x3, y3;
58  float lng0, lat0, lng1, lat1, lng2, lat2, lng3, lat3;
59 
60  string sensorId;
63  uint32_t dewarpWidth;
64  uint32_t dewarpHeight;
65  uint32_t num_views;
67 
69 typedef std::map<std::pair<uint32_t, uint32_t>, NvSpotCsvFields> _SpotIndex_Map;
70 typedef std::map<uint32_t, _SpotIndex_Map> _SpotCSVMap;
71 
73 typedef std::map<string, uint32_t> _SpotCameraMap;
74 
76 typedef std::map<uint32_t, uint32_t> _SpotCameraViews;
77 
78 typedef std::pair<_SpotIndex_Map::iterator, bool> _SpotIndexMap_Result;
79 typedef std::pair<_SpotCSVMap::iterator, bool> _SpotCSVMap_Result;
80 typedef std::pair<_SpotCameraMap::iterator, bool> _SpotCameraMap_Result;
81 typedef std::pair<_SpotCameraViews::iterator, bool> _SpotCameraView_Result;
82 
87 {
88  private:
89  _SpotCSVMap CSVMap;
90  _SpotCameraViews CameraViews;
91 
92  string csvFileName;
93 
94  void LoadCSVData();
95  void DestroyCSVParser();
96  uint32_t prepareSpotCSVMaxViews (uint32_t cam_id, vector<int>* vector_surface_index);
97 
98  public:
99  ~SpotCSVParser();
100 
104  int getNvSpotCSVFields (uint32_t cam_id, uint32_t surface_id, uint32_t spot_id, NvSpotCsvFields *fields);
107  uint32_t getNvSpotCSVMaxViews (uint32_t cam_id, vector<int>* array_surface_index);
109  void getNvSpotCSVData(std::vector<NvSpotCsvFields> &csvSpotData);
111  void printNvSpotCSVData(void);
113  void printNvSpotCSVData(uint32_t cam_id, uint32_t surface_id, uint32_t spot_id);
115  void printSpotCSVFields(NvSpotCsvFields val);
116 
117  SpotCSVParser(string CSVFileName);
118 };
119 
120 }
121 
122 #endif
nvspot_csv::_SpotCSVMap
std::map< uint32_t, _SpotIndex_Map > _SpotCSVMap
Definition: sources/includes/nv_spot_csvparser.hpp:70
nvspot_csv::_NvSpotCsvFields::rowId
uint32_t rowId
Row entry number in the CSV file.
Definition: sources/includes/nv_spot_csvparser.hpp:41
nvspot_csv::NvSpotCsvFields
struct nvspot_csv::_NvSpotCsvFields NvSpotCsvFields
Data structure contaning all the parameters specified in one row of a Spot CSV file.
nvspot_csv::_NvSpotCsvFields::dewarpFocalLength
float dewarpFocalLength
Focal Lenght of camera lens, in pixels per radian.
Definition: sources/includes/nv_spot_csvparser.hpp:62
nvspot_csv::_SpotCameraView_Result
std::pair< _SpotCameraViews::iterator, bool > _SpotCameraView_Result
Definition: sources/includes/nv_spot_csvparser.hpp:81
nvspot_csv::_SpotCameraMap_Result
std::pair< _SpotCameraMap::iterator, bool > _SpotCameraMap_Result
Definition: sources/includes/nv_spot_csvparser.hpp:80
nvspot_csv::_SpotIndex_Map
std::map< std::pair< uint32_t, uint32_t >, NvSpotCsvFields > _SpotIndex_Map
std::map<std::pair<surface_id, spot_index>, NvSpotCsvFields>
Definition: sources/includes/nv_spot_csvparser.hpp:69
nvspot_csv::_NvSpotCsvFields::sensorId
string sensorId
Sensor ID String.
Definition: sources/includes/nv_spot_csvparser.hpp:60
nvspot_csv::_SpotIndexMap_Result
std::pair< _SpotIndex_Map::iterator, bool > _SpotIndexMap_Result
Definition: sources/includes/nv_spot_csvparser.hpp:78
nvspot_csv::_NvSpotCsvFields::dewarpWidth
uint32_t dewarpWidth
dewarped surface width
Definition: sources/includes/nv_spot_csvparser.hpp:63
nvspot_csv::_NvSpotCsvFields::y3
float y3
Definition: sources/includes/nv_spot_csvparser.hpp:57
nvspot_csv::_NvSpotCsvFields::surfaceid
uint32_t surfaceid
Definition: sources/includes/nv_spot_csvparser.hpp:43
nvspot_csv::_SpotCSVMap_Result
std::pair< _SpotCSVMap::iterator, bool > _SpotCSVMap_Result
Definition: sources/includes/nv_spot_csvparser.hpp:79
nvspot_csv::_NvSpotCsvFields::spot_roi_y2
uint32_t spot_roi_y2
Definition: sources/includes/nv_spot_csvparser.hpp:54
nvspot_csv::_NvSpotCsvFields::cameraIdString
string cameraIdString
Camera ID String.
Definition: sources/includes/nv_spot_csvparser.hpp:42
nvspot_csv::_SpotCameraMap
std::map< string, uint32_t > _SpotCameraMap
std::map<camera-ipaddress, camera-id>
Definition: sources/includes/nv_spot_csvparser.hpp:73
nvspot_csv::_NvSpotCsvFields::spotId
string spotId
Unique Spot ID.
Definition: sources/includes/nv_spot_csvparser.hpp:46
nvspot_csv::_NvSpotCsvFields::num_views
uint32_t num_views
Definition: sources/includes/nv_spot_csvparser.hpp:65
nvspot_csv::_NvSpotCsvFields::dewarpYaw
double dewarpYaw
Definition: sources/includes/nv_spot_csvparser.hpp:48
nvspot_csv::_NvSpotCsvFields::dewarpHeight
uint32_t dewarpHeight
dewarped surface height
Definition: sources/includes/nv_spot_csvparser.hpp:64
nvspot_csv::_NvSpotCsvFields::lng3
float lng3
Definition: sources/includes/nv_spot_csvparser.hpp:58
nvspot_csv::SpotCSVParser
Class for parsing of Spot CSV data.
Definition: sources/includes/nv_spot_csvparser.hpp:86
nvspot_csv::_SpotCameraViews
std::map< uint32_t, uint32_t > _SpotCameraViews
std::map<camera-id, num_spot_views>
Definition: sources/includes/nv_spot_csvparser.hpp:76
nvspot_csv::_NvSpotCsvFields::cameraId
uint32_t cameraId
Serial number for each Spot View Camera Entry.
Definition: sources/includes/nv_spot_csvparser.hpp:40
nvspot_csv::_NvSpotCsvFields::spot_index
uint32_t spot_index
Surface Index 0,1 corrosponding to Spot View.
Definition: sources/includes/nv_spot_csvparser.hpp:44
nvspot_csv
Definition: sources/includes/nv_spot_csvparser.hpp:35
nvspot_csv::_NvSpotCsvFields::level
string level
Definition: sources/includes/nv_spot_csvparser.hpp:45
nvspot_csv::_NvSpotCsvFields::Horizon_y2
uint32_t Horizon_y2
Definition: sources/includes/nv_spot_csvparser.hpp:52
nvspot_csv::_NvSpotCsvFields::vertical_right
uint32_t vertical_right
Definition: sources/includes/nv_spot_csvparser.hpp:50
nvspot_csv::_NvSpotCsvFields
Data structure contaning all the parameters specified in one row of a Spot CSV file.
Definition: sources/includes/nv_spot_csvparser.hpp:38
nvspot_csv::_NvSpotCsvFields::vertical_left
uint32_t vertical_left
Definition: sources/includes/nv_spot_csvparser.hpp:49