22#include <linux/videodev2.h>
23#include <opencv2/core/core.hpp>
24#include <opencv2/imgproc/imgproc.hpp>
64 public jevois::Parameter<thresh1, thresh2, aperture, l2grad>
92 cv::Canny(grayimg, edges, thresh1::get(), thresh2::get(), aperture::get(), l2grad::get());
107 unsigned short winw, winh;
111 int x = 0, y = 0;
unsigned short iw = 0, ih = 0;
116 helper.
itext(
"JeVois-Pro Edge Detection");
122 cv::Canny(grayimg, edges, thresh1::get(), thresh2::get(), aperture::get(), l2grad::get());
125 cv::Mat chans[4] { edges, edges, edges, edges };
126 cv::Mat mask; cv::merge(chans, 4, mask);
129 helper.
drawImage(
"edges", mask,
true, x, y, iw, ih,
false ,
true );
132 std::string
const & fpscpu = timer.
stop();
133 helper.
iinfo(inframe, fpscpu, winw, winh);
JEVOIS_REGISTER_MODULE(ArUcoBlob)
Simple module to detect edges using the Canny algorithm from OpenCV.
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function.
virtual ~EdgeDetection()
Virtual destructor for safe inheritance.
JEVOIS_DECLARE_PARAMETER(thresh2, double, "Second threshold for hysteresis", 150.0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(l2grad, bool, "Use more accurate L2 gradient norm if true, L1 if false", false, ParamCateg)
Parameter.
virtual void process(jevois::InputFrame &&inframe, jevois::GUIhelper &helper) override
Processing function with zero-copy and GUI on JeVois-Pro.
JEVOIS_DECLARE_PARAMETER(aperture, int, "Aperture size for the Sobel operator", 3, ParamCateg)
Parameter.
friend friend class Module
void drawInputFrame(char const *name, InputFrame const &frame, int &x, int &y, unsigned short &w, unsigned short &h, bool noalias=false, bool casync=false)
bool startFrame(unsigned short &w, unsigned short &h)
void iinfo(jevois::InputFrame const &inframe, std::string const &fpscpu, unsigned short winw=0, unsigned short winh=0)
void itext(char const *txt, ImU32 const &col=IM_COL32_BLACK_TRANS, int line=-1)
void drawImage(char const *name, RawImage const &img, int &x, int &y, unsigned short &w, unsigned short &h, bool noalias=false, bool isoverlay=false)
void require(char const *info, unsigned int w, unsigned int h, unsigned int f) const
std::string const & stop(double *seconds)
cv::Mat cvImage(RawImage const &src)
cv::Mat convertToCvGray(RawImage const &src)