Commit 7f2ebb977c7eb271f8a25636e7d03fc81f66ee9f
1 parent
c4ff790d
Added Canny transform
Showing
1 changed file
with
35 additions
and
0 deletions
openbr/plugins/edge.cpp
0 → 100644
| 1 | +#include "openbr_internal.h" | |
| 2 | + | |
| 3 | +#include "opencv2/imgproc/imgproc.hpp" | |
| 4 | + | |
| 5 | +using namespace cv; | |
| 6 | + | |
| 7 | +namespace br | |
| 8 | +{ | |
| 9 | + | |
| 10 | +/*! | |
| 11 | + * \ingroup transforms | |
| 12 | + * \brief Warpper to OpenCV Canny edge detector | |
| 13 | + * \author Scott Klum \cite sklum | |
| 14 | + */ | |
| 15 | +class CannyTransform : public UntrainableTransform | |
| 16 | +{ | |
| 17 | + Q_OBJECT | |
| 18 | + Q_PROPERTY(double threshold READ get_threshold WRITE set_threshold RESET reset_threshold STORED false) | |
| 19 | + Q_PROPERTY(double aperatureSize READ get_aperatureSize WRITE set_aperatureSize RESET reset_aperatureSize STORED false) | |
| 20 | + Q_PROPERTY(bool L2Gradient READ get_L2Gradient WRITE set_L2Gradient RESET reset_L2Gradient STORED false) | |
| 21 | + BR_PROPERTY(double, threshold, 5) | |
| 22 | + BR_PROPERTY(double, aperatureSize, 3) | |
| 23 | + BR_PROPERTY(bool, L2Gradient, false) | |
| 24 | + | |
| 25 | + void project(const Template &src, Template &dst) const | |
| 26 | + { | |
| 27 | + Canny(src,dst, threshold, 3*threshold, aperatureSize, L2Gradient); | |
| 28 | + } | |
| 29 | +}; | |
| 30 | + | |
| 31 | +BR_REGISTER(Transform, CannyTransform) | |
| 32 | + | |
| 33 | +} // namespace br | |
| 34 | + | |
| 35 | +#include "edge.moc" | ... | ... |