Commit 05383a8c19f4e2d94f9d9bb9a1318984bb9d2b07
1 parent
b0487904
code cleanup
Showing
1 changed file
with
18 additions
and
18 deletions
sdk/plugins/meta.cpp
| ... | ... | @@ -26,13 +26,13 @@ using namespace cv; |
| 26 | 26 | namespace br |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | -static TemplateList Simplified(const TemplateList &templates) | |
| 29 | +static TemplateList Expanded(const TemplateList &templates) | |
| 30 | 30 | { |
| 31 | - TemplateList simplified; | |
| 31 | + TemplateList expanded; | |
| 32 | 32 | foreach (const Template &t, templates) { |
| 33 | 33 | if (t.isEmpty()) { |
| 34 | 34 | if (!t.file.getBool("enrollAll")) |
| 35 | - simplified.append(t); | |
| 35 | + expanded.append(t); | |
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | |
| ... | ... | @@ -46,13 +46,13 @@ static TemplateList Simplified(const TemplateList &templates) |
| 46 | 46 | |
| 47 | 47 | for (int i=0; i<t.size(); i++) { |
| 48 | 48 | if (!fte || !t.file.getBool("enrollAll")) { |
| 49 | - simplified.append(Template(t.file, t[i])); | |
| 50 | - simplified.last().file.setROIs(ROIs.mid(i*ROIStep, ROIStep)); | |
| 51 | - simplified.last().file.setLandmarks(landmarks.mid(i*landmarkStep, landmarkStep)); | |
| 49 | + expanded.append(Template(t.file, t[i])); | |
| 50 | + expanded.last().file.setROIs(ROIs.mid(i*ROIStep, ROIStep)); | |
| 51 | + expanded.last().file.setLandmarks(landmarks.mid(i*landmarkStep, landmarkStep)); | |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - return simplified; | |
| 55 | + return expanded; | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | static void _train(Transform *transform, const TemplateList *data) |
| ... | ... | @@ -93,6 +93,7 @@ static void incrementStep() |
| 93 | 93 | * The source br::Template is given to the first transform and the resulting br::Template is passed to the next transform, etc. |
| 94 | 94 | * |
| 95 | 95 | * \see ExpandTransform |
| 96 | + * \see ForkTransform | |
| 96 | 97 | */ |
| 97 | 98 | class PipeTransform : public MetaTransform |
| 98 | 99 | { |
| ... | ... | @@ -142,10 +143,9 @@ class PipeTransform : public MetaTransform |
| 142 | 143 | void backProject(const Template &dst, Template &src) const |
| 143 | 144 | { |
| 144 | 145 | src = dst; |
| 145 | - //reverse order in which transforms are processed | |
| 146 | + // Reverse order in which transforms are processed | |
| 146 | 147 | int length = transforms.length(); |
| 147 | - //foreach (const Transform *f, transforms) { | |
| 148 | - for (int i=length-1; i>=0; i--){ | |
| 148 | + for (int i=length-1; i>=0; i--) { | |
| 149 | 149 | Transform *f = transforms.at(i); |
| 150 | 150 | try { |
| 151 | 151 | src >> *f; |
| ... | ... | @@ -156,18 +156,17 @@ class PipeTransform : public MetaTransform |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | - | |
| 160 | 159 | }; |
| 161 | 160 | |
| 162 | 161 | BR_REGISTER(Transform, PipeTransform) |
| 163 | 162 | |
| 164 | 163 | /*! |
| 165 | 164 | * \ingroup transforms |
| 166 | - * \brief Transforms in series. | |
| 165 | + * \brief Transforms in series with expansion step. | |
| 167 | 166 | * \author Josh Klontz \cite jklontz |
| 168 | 167 | * |
| 169 | 168 | * The source br::Template is given to the first transform and the resulting br::Template is passed to the next transform, etc. |
| 170 | - * Each matrix is reorganized into a new template before continuing. | |
| 169 | + * Each matrix is expanded into its own template between steps. | |
| 171 | 170 | * |
| 172 | 171 | * \see PipeTransform |
| 173 | 172 | */ |
| ... | ... | @@ -185,7 +184,7 @@ class ExpandTransform : public MetaTransform |
| 185 | 184 | for (int i=0; i<transforms.size(); i++) { |
| 186 | 185 | transforms[i]->train(copy); |
| 187 | 186 | copy >> *transforms[i]; |
| 188 | - copy = Simplified(copy); | |
| 187 | + copy = Expanded(copy); | |
| 189 | 188 | incrementStep(); |
| 190 | 189 | } |
| 191 | 190 | |
| ... | ... | @@ -211,17 +210,16 @@ class ExpandTransform : public MetaTransform |
| 211 | 210 | dst = src; |
| 212 | 211 | for (int i=0; i<transforms.size(); i++) { |
| 213 | 212 | dst >> *transforms[i]; |
| 214 | - dst = Simplified(dst); | |
| 213 | + dst = Expanded(dst); | |
| 215 | 214 | } |
| 216 | 215 | } |
| 217 | 216 | |
| 218 | 217 | void backProject(const Template &dst, Template &src) const |
| 219 | 218 | { |
| 220 | 219 | src = dst; |
| 221 | - //reverse order in which transforms are processed | |
| 220 | + // Reverse order in which transforms are processed | |
| 222 | 221 | int length = transforms.length(); |
| 223 | - //foreach (const Transform *f, transforms) { | |
| 224 | - for (int i=length-1; i>=0; i--){ | |
| 222 | + for (int i=length-1; i>=0; i--) { | |
| 225 | 223 | Transform *f = transforms.at(i); |
| 226 | 224 | try { |
| 227 | 225 | src >> *f; |
| ... | ... | @@ -242,6 +240,8 @@ BR_REGISTER(Transform, ExpandTransform) |
| 242 | 240 | * \author Josh Klontz \cite jklontz |
| 243 | 241 | * |
| 244 | 242 | * The source br::Template is seperately given to each transform and the results are appended together. |
| 243 | + * | |
| 244 | + * \see PipeTransform | |
| 245 | 245 | */ |
| 246 | 246 | class ForkTransform : public MetaTransform |
| 247 | 247 | { | ... | ... |