Mercurial > hg > match-vamp
comparison src/Matcher.h @ 72:c3c50d5e05b7 refactors
Pull up Matcher set/get to public API, use only public API in Finder
author | Chris Cannam |
---|---|
date | Wed, 19 Nov 2014 10:18:19 +0000 |
parents | cba231851957 |
children | b9aa663a607b |
comparison
equal
deleted
inserted
replaced
71:cba231851957 | 72:c3c50d5e05b7 |
---|---|
125 | 125 |
126 int getFrameCount() { | 126 int getFrameCount() { |
127 return m_frameCount; | 127 return m_frameCount; |
128 } | 128 } |
129 | 129 |
130 int getOtherFrameCount() { | |
131 return m_otherMatcher->getFrameCount(); | |
132 } | |
133 | |
134 /** Tests whether a location is in range in the minimum cost matrix. | |
135 * | |
136 * @param i the frame number of this Matcher | |
137 * @param j the frame number of the other Matcher | |
138 * @return true if the location is in range | |
139 */ | |
140 bool isInRange(int i, int j); | |
141 | |
142 /** Tests whether a location is available in the minimum cost matrix. | |
143 * | |
144 * @param i the frame number of this Matcher | |
145 * @param j the frame number of the other Matcher | |
146 * @return true if the location is in range and contains a valid cost | |
147 */ | |
148 bool isAvailable(int i, int j); | |
149 | |
150 /** Returns the valid range of frames in the other Matcher for the | |
151 * given frame in this Matcher's minimum cost matrix. | |
152 * | |
153 * @param i the frame number of this Matcher | |
154 * @return the first, last pair of frame numbers for the other | |
155 * Matcher. Note that the last frame is exclusive (last valid | |
156 * frame + 1). | |
157 */ | |
158 std::pair<int, int> getColRange(int i); | |
159 | |
160 /** Returns the valid range of frames in this Matcher for the | |
161 * given frame in the other Matcher's minimum cost matrix. | |
162 * | |
163 * @param i the frame number of the other Matcher | |
164 * @return the first, last pair of frame numbers for this | |
165 * Matcher. Note that the last frame is exclusive (last valid | |
166 * frame + 1). | |
167 */ | |
168 std::pair<int, int> getRowRange(int i); | |
169 | |
170 /** Retrieves a value from the distance matrix. | |
171 * | |
172 * @param i the frame number of this Matcher | |
173 * @param j the frame number of the other Matcher | |
174 * @return the distance metric at this location | |
175 */ | |
176 float getDistance(int i, int j); | |
177 | |
178 /** Sets a value to the distance matrix. | |
179 * | |
180 * @param i the frame number of this Matcher | |
181 * @param j the frame number of the other Matcher | |
182 * @param value the distance metric to set for this location | |
183 */ | |
184 void setDistance(int i, int j, float value); | |
185 | |
186 /** Retrieves a value from the minimum cost matrix. | |
187 * | |
188 * @param i the frame number of this Matcher | |
189 * @param j the frame number of the other Matcher | |
190 * @return the cost of the minimum cost path to this location | |
191 */ | |
192 double getPathCost(int i, int j); | |
193 | |
194 /** Sets a value and an advance direction to the minimum cost matrix. | |
195 * | |
196 * @param i the frame number of this Matcher | |
197 * @param j the frame number of the other Matcher | |
198 * @param dir the direction from which this position is reached with | |
199 * minimum cost | |
200 * @param value the cost of the minimum cost path to set for this location | |
201 */ | |
202 void setPathCost(int i, int j, Advance dir, double value); | |
203 | |
204 /** Retrieves an advance direction from the matrix. | |
205 * | |
206 * @param i the frame number of this Matcher | |
207 * @param j the frame number of the other Matcher | |
208 * @return the direction from which this position is reached with | |
209 * minimum cost | |
210 */ | |
211 Advance getAdvance(int i, int j); | |
212 | |
130 protected: | 213 protected: |
131 /** Create internal structures and reset. */ | 214 /** Create internal structures and reset. */ |
132 void init(); | 215 void init(); |
133 | 216 |
134 /** The distXSize value has changed: resize internal buffers. */ | 217 /** The distXSize value has changed: resize internal buffers. */ |
160 * use this function. The supplied feature must be of the size | 243 * use this function. The supplied feature must be of the size |
161 * that was passed to the constructor. | 244 * that was passed to the constructor. |
162 */ | 245 */ |
163 void consumeFeatureVector(std::vector<double> feature); | 246 void consumeFeatureVector(std::vector<double> feature); |
164 | 247 |
165 /** Tests whether a location is in range in the minimum cost matrix. | |
166 * | |
167 * @param i the frame number of this Matcher | |
168 * @param j the frame number of the other Matcher | |
169 * @return true if the location is in range | |
170 */ | |
171 bool isInRange(int i, int j); | |
172 | |
173 /** Tests whether a location is available in the minimum cost matrix. | |
174 * | |
175 * @param i the frame number of this Matcher | |
176 * @param j the frame number of the other Matcher | |
177 * @return true if the location is in range and contains a valid cost | |
178 */ | |
179 bool isAvailable(int i, int j); | |
180 | |
181 /** Retrieves a value from the minimum cost matrix. | |
182 * | |
183 * @param i the frame number of this Matcher | |
184 * @param j the frame number of the other Matcher | |
185 * @return the cost of the minimum cost path to this location | |
186 */ | |
187 double getValue(int i, int j); | |
188 | |
189 /** Sets a value to the minimum cost matrix. | |
190 * | |
191 * @param i the frame number of this Matcher | |
192 * @param j the frame number of the other Matcher | |
193 * @param value the cost of the minimum cost path to set for this location | |
194 */ | |
195 void setValue(int i, int j, double value); | |
196 | |
197 /** Updates an entry in the distance matrix and the optimal path matrix. | 248 /** Updates an entry in the distance matrix and the optimal path matrix. |
198 * | 249 * |
199 * @param i the frame number of this Matcher | 250 * @param i the frame number of this Matcher |
200 * @param j the frame number of the other Matcher | 251 * @param j the frame number of the other Matcher |
201 * @param dir the direction from which this position is reached with | 252 * @param dir the direction from which this position is reached with |
267 FeatureExtractor m_featureExtractor; | 318 FeatureExtractor m_featureExtractor; |
268 DistanceMetric m_metric; | 319 DistanceMetric m_metric; |
269 | 320 |
270 friend class MatchFeeder; | 321 friend class MatchFeeder; |
271 friend class MatchFeatureFeeder; | 322 friend class MatchFeatureFeeder; |
272 friend class Finder; | 323 |
273 | |
274 }; // class Matcher | 324 }; // class Matcher |
275 | 325 |
276 #endif | 326 #endif |