MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / CVATAnnotationsGenerator

Class CVATAnnotationsGenerator

example/cvatAnnotationsGenerator.h:8–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7///
8class CVATAnnotationsGenerator
9{
10public:
11 ///
12 CVATAnnotationsGenerator(const std::string& annFileName)
13 : m_annFileName(annFileName)
14 {
15 }
16
17 ///
18 bool NewDetects(int frameInd, const std::vector<TrackingObject>& tracks, size_t detectorInd)
19 {
20 if (m_annFileName.empty())
21 return false;
22
23 auto it = m_detects.find(frameInd);
24 if (it == m_detects.end())
25 {
26 if (detectorInd == 0)
27 {
28 m_detects.emplace(frameInd, tracks);
29 }
30 else
31 {
32 std::vector<TrackingObject> tmpTracks = tracks;
33 for (auto& track : tmpTracks)
34 {
35 track.m_ID.m_val += detectorInd * DetectorIDRange;
36 }
37 m_detects.emplace(frameInd, tmpTracks);
38 }
39
40 //it = m_detects.find(frameInd);
41 //std::cout << "New detects 1: Frame " << frameInd << ", detector ind " << detectorInd << std::endl;
42 //for (const auto& track : it->second)
43 //{
44 // std::cout << "track " << track.m_ID.ID2Str() << ", type = " << track.m_type << ", rect = " << track.m_rrect.boundingRect() << std::endl;
45 //}
46 }
47 else
48 {
49 if (detectorInd == 0)
50 {
51 it->second.insert(it->second.end(), tracks.begin(), tracks.end());
52 }
53 else
54 {
55 std::vector<TrackingObject> tmpTracks = tracks;
56 for (auto& track : tmpTracks)
57 {
58 track.m_ID.m_val += detectorInd * DetectorIDRange;
59 }
60 it->second.insert(it->second.end(), tmpTracks.begin(), tmpTracks.end());
61 }
62
63 //std::cout << "New detects 2: Frame " << frameInd << ", detector ind " << detectorInd << std::endl;
64 //for (const auto& track : it->second)
65 //{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected