Commit 041f40407738d8d8575c7f9c6fa2ca63fb7d7193
1 parent
6770a2a1
Add initial HoG and HoGHoF
Showing
2 changed files
with
27 additions
and
0 deletions
openbr/plugins/algorithms.cpp
| ... | ... | @@ -50,6 +50,8 @@ class AlgorithmsInitializer : public Initializer |
| 50 | 50 | Globals->abbreviations.insert("PerFrameDetection", "Stream([SaveMat(original)+Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+RestoreMat(original)+Draw(inPlace=true),Show(false,[FrameNumber])+Discard])"); |
| 51 | 51 | Globals->abbreviations.insert("AgeGenderDemo", "Stream([SaveMat(original)+Cvt(Gray)+Cascade(FrontalFace)+Expand+<FaceClassificationRegistration>+<FaceClassificationExtraction>+(<AgeRegressor>+Rename(Subject,Age)+Discard)/(<GenderClassifier>+Rename(Subject,Gender)+Discard)+RestoreMat(original)+Draw(inPlace=true)+DrawPropertiesPoint([Age,Gender],Affine_0,inPlace=true)+SaveMat(original)+Discard+Contract,RestoreMat(original)+FPSCalc+Show(false,[AvgFPS,Age,Gender])+Discard])"); |
| 52 | 52 | Globals->abbreviations.insert("HoF", "Stream([KeyPointDetector(SIFT),AggregateFrames(2)+OpticalFlow,InterestRegions,Hist+Discard])"); |
| 53 | + Globals->abbreviations.insert("HoG", "Stream([KeyPointDetector(SIFT),InterestRegions,HoGDescriptor+Discard])"); | |
| 54 | + Globals->abbreviations.insert("HoGHoF", "Stream([KeyPointDetector(SIFT),(AggregateFrames(2)+OpticalFlow+InterestRegions+Hist)/(InterestRegions+HoGDescriptor),Cat])"); | |
| 53 | 55 | |
| 54 | 56 | // Generic Image Processing |
| 55 | 57 | Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); | ... | ... |
openbr/plugins/keypoint.cpp
| ... | ... | @@ -178,6 +178,31 @@ BR_REGISTER(Transform, SIFTDescriptorTransform) |
| 178 | 178 | |
| 179 | 179 | /*! |
| 180 | 180 | * \ingroup transforms |
| 181 | + * \brief OpenCV HOGDescriptor wrapper | |
| 182 | + * \author Austin Blanton \cite imaus10 | |
| 183 | + */ | |
| 184 | +class HoGDescriptorTransform : public UntrainableTransform | |
| 185 | +{ | |
| 186 | + Q_OBJECT | |
| 187 | + | |
| 188 | + HOGDescriptor hog; | |
| 189 | + | |
| 190 | + void project(const Template &src, Template &dst) const | |
| 191 | + { | |
| 192 | + std::vector<float> descriptorVals; | |
| 193 | + std::vector<Point> locations; | |
| 194 | + Size winStride = Size(0,0); | |
| 195 | + Size padding = Size(0,0); | |
| 196 | + hog.compute(src, descriptorVals, winStride, padding, locations); | |
| 197 | + Mat HoGFeats = Mat<float>(descriptorVals, true); | |
| 198 | + dst += HoGFeats; | |
| 199 | + } | |
| 200 | +}; | |
| 201 | + | |
| 202 | +BR_REGISTER(Transform, HoGDescriptorTransform) | |
| 203 | + | |
| 204 | +/*! | |
| 205 | + * \ingroup transforms | |
| 181 | 206 | * \brief Add landmarks to the template in a grid layout |
| 182 | 207 | * \author Josh Klontz \cite jklontz |
| 183 | 208 | */ | ... | ... |