MPEG CDVA Experimentation Model (CXM)  1.0
Compact Descriptors for Visual Analisys
cdva.h
Go to the documentation of this file.
1 /*
2 The copyright in this software is being made available under this MPEG Reference Software Copyright License. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
3 
4 Copyright (c) 2016-2017, Joanneum Research, Mitsubishi Electric Research Labs, Peking University, Telecom Italia, University of Surrey, Visual Atoms
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 * Neither the names of Joanneum Research, Mitsubishi Electric Research Labs, Peking University, Telecom Italia, University of Surrey, Visual Atoms nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 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 HOLDER 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.
11 */
12 #pragma once
13 #include <string>
14 
31 namespace mpeg7cdva
32 {
33 
38 class ExtractData {
39 public:
41  double clip_duration;
42  double numframes;
43  double numshots;
44 
45  // counters - required by CDVA core experiments
46 
52 
54  {
55  clip_duration = 0;
56  descriptorlength = 0;
57  numframes = 0;
58  numshots = 0;
59  header_bit_count =
60  local_bit_count =
61  global_bit_count =
62  coordinate_bit_count =
63  n_keyframes = 0;
64  }
65 
70  void setVideoDuration(double time)
71  {
72  clip_duration = time;
73  }
74 
79  void setNumFrames(double nframes)
80  {
81  numframes = nframes;
82  }
83 
88  void setNumShots(double nshots)
89  {
90  numshots = nshots;
91  }
92 
93 
98  void setDescriptorLength(double length)
99  {
100  descriptorlength = length;
101  }
102 
103 };
104 
109 class MatchData {
110 private:
111  double score; // score of matching
112  std::string reference_ID; // identifier of the matching reference video
113  double startTime; // time in seconds indicating the fist matching frame of the query clip (e.g. 3.456 s)
114  double endTime; // time in seconds indicating the last matching frame of the query clip (e.g. 6.352 s)
115 
116 public:
118  {
119  score = 0;
120  startTime = endTime = -1;
121  }
122 
123  virtual ~MatchData()
124  {}
125 
126 
131  void setMatchingScore(double myscore)
132  {
133  score = myscore; // save score
134  }
135 
140  void setMatchingTime(double time_s)
141  {
142  if (startTime < 0)
143  {
144  startTime = endTime = time_s; // this is the first frame matching
145  }
146  else
147  {
148  if (time_s > endTime)
149  endTime = time_s;
150 
151  if (time_s < startTime)
152  startTime = time_s;
153  }
154  }
155 
160  void setReferenceID(const std::string reference)
161  {
162  reference_ID = reference;
163  }
164 
169  double getScore() const
170  {
171  return score;
172  }
173 
178  double getFirstMatchingTime() const
179  {
180  return startTime;
181  }
182 
187  double getLastMatchingTime() const
188  {
189  return endTime;
190  }
191 
196  std::string getReferenceId() const
197  {
198  return reference_ID;
199  }
200 
201 };
202 
203 } // end of namespace
double getFirstMatchingTime() const
get the time in seconds indicating the fist matching frame of the query clip.
Definition: cdva.h:178
double descriptorlength
Definition: cdva.h:40
double getLastMatchingTime() const
get the time in seconds indicating the last matching frame of the query clip.
Definition: cdva.h:187
void setDescriptorLength(double length)
set the actual descriptor length (in bytes).
Definition: cdva.h:98
void setVideoDuration(double time)
set the video duration in seconds.
Definition: cdva.h:70
void setMatchingTime(double time_s)
set the time of each frame matching (only the first and the last will be saved).
Definition: cdva.h:140
A class containing the results of a matching or retrieval operation.
Definition: cdva.h:109
int global_bit_count
Definition: cdva.h:49
Namespace used to encapsulate all MPEG-7 CDVA declarations.
Definition: Buffer.h:14
ExtractData()
Definition: cdva.h:53
virtual ~MatchData()
Definition: cdva.h:123
double getScore() const
Get the matching score.
Definition: cdva.h:169
MatchData()
Definition: cdva.h:117
int local_bit_count
Definition: cdva.h:48
int header_bit_count
Definition: cdva.h:47
double clip_duration
Definition: cdva.h:41
std::string getReferenceId() const
get the string that identifies the matching reference video clip.
Definition: cdva.h:196
double numshots
Definition: cdva.h:43
double numframes
Definition: cdva.h:42
int coordinate_bit_count
Definition: cdva.h:50
void setMatchingScore(double myscore)
set the score of matching the query image with the reference image.
Definition: cdva.h:131
void setReferenceID(const std::string reference)
set the string that identifies the matching reference video clip.
Definition: cdva.h:160
A class containing the results of an extraction operation.
Definition: cdva.h:38
int n_keyframes
Definition: cdva.h:51
void setNumShots(double nshots)
set the number of shots of the video clip.
Definition: cdva.h:88
void setNumFrames(double nframes)
set the number of frames of the video clip.
Definition: cdva.h:79