Commit 6f5e4fc58ace78aaa8833411ff3f0994ad527b13
Merge pull request #217 from biometrics/addAttributeAlgorithm
Add attribute algorithm
Showing
1 changed file
with
129 additions
and
0 deletions
openbr/plugins/turk.cpp
| ... | ... | @@ -174,6 +174,135 @@ class TurkDistance : public Distance |
| 174 | 174 | |
| 175 | 175 | BR_REGISTER(Distance, TurkDistance) |
| 176 | 176 | |
| 177 | +/*! | |
| 178 | + * \ingroup initializers | |
| 179 | + * \brief Initializes global abbreviations with implemented algorithms for attributes | |
| 180 | + * \author Babatunde Ogunfemi \cite baba1472 | |
| 181 | + */ | |
| 182 | +class AttributeAlgorithmsInitializer : public Initializer | |
| 183 | +{ | |
| 184 | + Q_OBJECT | |
| 185 | + | |
| 186 | + void initialize() const | |
| 187 | + { | |
| 188 | + // Constants | |
| 189 | + QString BASE="Open+PP5Register+Rename(PP5_Landmark0_Right_Eye,Affine_0)+Rename(PP5_Landmark1_Left_Eye,Affine_1)+Affine(192,240,.345,.475)+Cvt(Gray)+Stasm(false,true,[(66.24,114),(125.76,114)])"; | |
| 190 | + QString SUBSPACE ="Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,4,4)+Hist(59)+Cat+PCA(0.95)"; | |
| 191 | + | |
| 192 | + QString NOSE="RectFromStasmNoseWithBridge+ROI+Resize(36,24)+" + SUBSPACE; | |
| 193 | + QString MOUTH="RectFromStasmMouth+ROI+Resize(24,36)+" + SUBSPACE; | |
| 194 | + QString EYES="RectFromStasmEyes+ROI+Resize(24,36)+" + SUBSPACE; | |
| 195 | + QString HAIR="RectFromStasmHair+ROI+Resize(24,36)+" + SUBSPACE; | |
| 196 | + QString BROW="RectFromStasmBrow+ROI+Resize(24,36)+" + SUBSPACE; | |
| 197 | + QString JAW="RectFromStasmJaw+ROI+Resize(36,36)+" + SUBSPACE; | |
| 198 | + QString FACE = "Crop(24,30,144,190)+Resize(36,36)+" + SUBSPACE; | |
| 199 | + | |
| 200 | + // All Attributes | |
| 201 | + Globals->abbreviations.insert("AllAttributes", "AttributeBrow/AttributeMouth/AttributeEyes/AttributeFace/AttributeHair/AttributeNose/AttributeJaw"); | |
| 202 | + Globals->abbreviations.insert("AllAttributesMatching", "(AttributeBrow)/(AttributeMouth)/(AttributeEyes)/(AttributeFace)/(AttributeHair)/(AttributeNose)/(AttributeJaw):AttributeMatch"); | |
| 203 | + | |
| 204 | + //Individual Attributes | |
| 205 | + Globals->abbreviations.insert("AttributeBrow", "(" + BASE+ "+" + BROW + "+" | |
| 206 | + "TurkClassifier(eyebrowposition,[closebrows,highbrows],3)/" | |
| 207 | + "TurkClassifier(unibrow,[unibrow],3)/" | |
| 208 | + "TurkClassifier(eyebroworientation,[eyebrowsdown,eyebrowsuptodown],3)/" | |
| 209 | + "TurkClassifier(thickeyebrows,[thickeyebrows,lighteyebrows],3))"); | |
| 210 | + Globals->abbreviations.insert("AttributeMouth", "(" + BASE + "+" + MOUTH + "+" | |
| 211 | + "TurkClassifier(smiling,[smiling],3)/" | |
| 212 | + "TurkClassifier(lipthickness,[cherry,big,small],3)/" | |
| 213 | + "TurkClassifier(mouthbite,[underbite,overbite],3)/" | |
| 214 | + "TurkClassifier(mouthopen,[closed,noteeth,halfteeth,allteeth],3)/" | |
| 215 | + "TurkClassifier(mouthwidth,[small,wide],3)/" | |
| 216 | + "TurkClassifier(mustache,[nomustache,linemustache,lightmustache,normalmustache,down],3)/" | |
| 217 | + "TurkClassifier(mouthasymmetry,[asymmetrical],3))"); | |
| 218 | + Globals->abbreviations.insert("AttributeEyes", "(" + BASE + "+" + EYES + "+ " | |
| 219 | + "TurkClassifier(eyeseparation,[close,wide],3)/" | |
| 220 | + "TurkClassifier(eyeslant,[slant2,slant1,wild],3)/" | |
| 221 | + "TurkClassifier(benteyes,[bent])/" | |
| 222 | + "TurkClassifier(eyecolor,[darkeyes,lighteyes],3)/" | |
| 223 | + "TurkClassifier(baggyeyes,[baggy],3)/" | |
| 224 | + "TurkClassifier(almondeyes,[almond],3)/" | |
| 225 | + "TurkClassifier(buriedeyes,[buriedeyes],3)/" | |
| 226 | + "TurkClassifier(sleepyeyes,[sleepy],3)/" | |
| 227 | + "TurkClassifier(lineeyes,[line],3)/" | |
| 228 | + "TurkClassifier(roundeyes,[round],3)/" | |
| 229 | + "TurkClassifier(sharpeyes,[sharp],3)/" | |
| 230 | + "TurkClassifier(smalleyes,[smalleyes],3)/" | |
| 231 | + "TurkClassifier(glasses,[glasses],3)/" | |
| 232 | + "TurkClassifier(eyelashvisibility,[feweyelashes],3))"); | |
| 233 | + Globals->abbreviations.insert("AttributeFace", "(" + BASE + "+" + FACE + "+" | |
| 234 | + "TurkClassifier(gender,[male],3)/" | |
| 235 | + "TurkClassifier(faceshape,[round,triangular,rectangular],3)/" | |
| 236 | + "TurkClassifier(cheekdensity,[puffy,in,normal],3)/" | |
| 237 | + "TurkClassifier(facemarks,[scars,moles,normal],3)/" | |
| 238 | + "TurkClassifier(facelength,[long],3)/" | |
| 239 | + "TurkClassifier(nosetoeyedist,[short,long],3)/" | |
| 240 | + "TurkClassifier(nosetomouthdist,[long,small],3))"); | |
| 241 | + Globals->abbreviations.insert("AttributeHair", "(" + BASE + "+" + HAIR + "+" | |
| 242 | + "TurkClassifier(foreheadwrinkles,[wrinkled],3)/" | |
| 243 | + "TurkClassifier(foreheadsize,[smallforehead,largeforehead],3)/" | |
| 244 | + "TurkClassifier(haircolor,[darkhair,lighthair,greyhair],3)/" | |
| 245 | + "TurkClassifier(hairdensity,[thick,bald,thin,halfbald],3)/" | |
| 246 | + "TurkClassifier(widowspeak,[widowspeak],3)/" | |
| 247 | + "TurkClassifier(hairstyle,[curlyhair],3))"); | |
| 248 | + Globals->abbreviations.insert("AttributeNose", "(" + BASE + "+" + NOSE + "+" | |
| 249 | + "TurkClassifier(noseorientation,[upnose,downnose],3)/" | |
| 250 | + "TurkClassifier(nosewidth,[small,thick],3)/" | |
| 251 | + "TurkClassifier(nosesize,[smallnose,bignose],3)/" | |
| 252 | + "TurkClassifier(brokennose,[broken],3))"); | |
| 253 | + Globals->abbreviations.insert("AttributeJaw", "(" + BASE + "+" + JAW + "+" | |
| 254 | + "TurkClassifier(beard,[nobeard,bigbeard,lightbeard,goatee,linebeard,normalbeard,lincolnbeard],3)/" | |
| 255 | + "TurkClassifier(chinsize,[shortchin,longchin],3))"); | |
| 256 | + Globals->abbreviations.insert("AttributeMatch", "Fuse([" | |
| 257 | + "Turk(eyebrowposition,[closebrows,highbrows],3)," | |
| 258 | + "Turk(unibrow,[unibrow],3)," | |
| 259 | + "Turk(eyebroworientation,[eyebrowsdown,eyebrowsuptodown],3)," | |
| 260 | + "Turk(thickeyebrows,[thickeyebrows,lighteyebrows],3)," | |
| 261 | + "Turk(smiling,[smiling],3)," | |
| 262 | + "Turk(lipthickness,[cherry,big,small],3)," | |
| 263 | + "Turk(mouthbite,[underbite,overbite],3)," | |
| 264 | + "Turk(mouthopen,[closed,noteeth,halfteeth,allteeth],3)," | |
| 265 | + "Turk(mouthwidth,[small,wide],3)," | |
| 266 | + "Turk(mustache,[nomustache,linemustache,lightmustache,normalmustache,down],3)," | |
| 267 | + "Turk(mouthasymmetry,[asymmetrical],3)," | |
| 268 | + "Turk(eyeseparation,[close,wide],3)," | |
| 269 | + "Turk(eyeslant,[slant2,slant1,wild],3)," | |
| 270 | + "Turk(benteyes,[bent],3)," | |
| 271 | + "Turk(eyecolor,[darkeyes,lighteyes],3)," | |
| 272 | + "Turk(baggyeyes,[baggy],3)," | |
| 273 | + "Turk(almondeyes,[almond],3)," | |
| 274 | + "Turk(buriedeyes,[buriedeyes],3)," | |
| 275 | + "Turk(sleepyeyes,[sleepy],3)," | |
| 276 | + "Turk(lineeyes,[line],3)," | |
| 277 | + "Turk(roundeyes,[round],3)," | |
| 278 | + "Turk(sharpeyes,[sharp],3)," | |
| 279 | + "Turk(smalleyes,[smalleyes],3)," | |
| 280 | + "Turk(glasses,[glasses],3)," | |
| 281 | + "Turk(eyelashvisibility,[feweyelashes],3)," | |
| 282 | + "Turk(gender,[male],3)," | |
| 283 | + "Turk(faceshape,[round,triangular,rectangular],3)," | |
| 284 | + "Turk(cheekdensity,[puffy,in,normal],3)," | |
| 285 | + "Turk(facemarks,[scars,moles,normal],3)," | |
| 286 | + "Turk(facelength,[long],3)," | |
| 287 | + "Turk(nosetoeyedist,[short,long],3)," | |
| 288 | + "Turk(nosetomouthdist,[long,small],3)," | |
| 289 | + "Turk(foreheadwrinkles,[wrinkled],3)," | |
| 290 | + "Turk(foreheadsize,[smallforehead,largeforehead],3)," | |
| 291 | + "Turk(haircolor,[darkhair,lighthair,greyhair],3)," | |
| 292 | + "Turk(hairdensity,[thick,bald,thin,halfbald],3)," | |
| 293 | + "Turk(widowspeak,[widowspeak],3)," | |
| 294 | + "Turk(hairstyle,[curlyhair],3)," | |
| 295 | + "Turk(noseorientation,[upnose,downnose],3)," | |
| 296 | + "Turk(nosewidth,[small,thick],3)," | |
| 297 | + "Turk(nosesize,[smallnose,bignose],3)," | |
| 298 | + "Turk(brokennose,[broken],3)," | |
| 299 | + "Turk(beard,[nobeard,bigbeard,lightbeard,goatee,linebeard,normalbeard,lincolnbeard],3)," | |
| 300 | + "Turk(chinsize,[shortchin,longchin],3)])"); | |
| 301 | + } | |
| 302 | +}; | |
| 303 | + | |
| 304 | +BR_REGISTER(Initializer, AttributeAlgorithmsInitializer) | |
| 305 | + | |
| 177 | 306 | } // namespace br |
| 178 | 307 | |
| 179 | 308 | #include "turk.moc" | ... | ... |