From 7f2ebb977c7eb271f8a25636e7d03fc81f66ee9f Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 16 Feb 2015 10:58:07 -0500 Subject: [PATCH] Added Canny transform --- openbr/plugins/edge.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+), 0 deletions(-) create mode 100644 openbr/plugins/edge.cpp diff --git a/openbr/plugins/edge.cpp b/openbr/plugins/edge.cpp new file mode 100644 index 0000000..a17e5f5 --- /dev/null +++ b/openbr/plugins/edge.cpp @@ -0,0 +1,35 @@ +#include "openbr_internal.h" + +#include "opencv2/imgproc/imgproc.hpp" + +using namespace cv; + +namespace br +{ + +/*! + * \ingroup transforms + * \brief Warpper to OpenCV Canny edge detector + * \author Scott Klum \cite sklum + */ +class CannyTransform : public UntrainableTransform +{ + Q_OBJECT + Q_PROPERTY(double threshold READ get_threshold WRITE set_threshold RESET reset_threshold STORED false) + Q_PROPERTY(double aperatureSize READ get_aperatureSize WRITE set_aperatureSize RESET reset_aperatureSize STORED false) + Q_PROPERTY(bool L2Gradient READ get_L2Gradient WRITE set_L2Gradient RESET reset_L2Gradient STORED false) + BR_PROPERTY(double, threshold, 5) + BR_PROPERTY(double, aperatureSize, 3) + BR_PROPERTY(bool, L2Gradient, false) + + void project(const Template &src, Template &dst) const + { + Canny(src,dst, threshold, 3*threshold, aperatureSize, L2Gradient); + } +}; + +BR_REGISTER(Transform, CannyTransform) + +} // namespace br + +#include "edge.moc" -- libgit2 0.21.4