21#include <opencv2/imgproc/imgproc.hpp>
22#include <opencv2/features2d.hpp>
72 cv::SimpleBlobDetector::Params params;
73 params.filterByCircularity =
true;
74 params.filterByArea =
true;
75 params.minArea = 200.0f;
78 itsDetector = cv::SimpleBlobDetector::create(params);
101 outimg = outframe.get();
114 cv::GaussianBlur(grayImage, grayImage, cv::Size(5, 5), 0, 0);
117 cv::threshold(grayImage, grayImage, 0.0, 255, cv::THRESH_BINARY_INV | cv::THRESH_OTSU);
121 int const morphBNo2 = 2;
122 cv::dilate(grayImage, grayImage, kernel, cv::Point(-1, -1), morphBNo2);
123 cv::Mat image(grayImage.rows, grayImage.cols, CV_8U, cv::Scalar(255, 255, 255));
124 cv::Mat invBack2 = image - grayImage;
127 std::vector<cv::KeyPoint> keypoints;
128 itsDetector->detect(invBack2, keypoints);
129 int nrOfBlobs = keypoints.size();
138 for (cv::KeyPoint
const & kp : keypoints)
147 std::string
const & fpscpu = timer.
stop();
154 if (nrOfBlobs)
sendSerial(
"PIPS " + std::to_string(nrOfBlobs));
158 cv::Ptr<cv::SimpleBlobDetector> itsDetector;
JEVOIS_REGISTER_MODULE(ArUcoBlob)
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function.
virtual ~DiceCounter()
Virtual destructor for safe inheritance.
DiceCounter(std::string const &instance)
Constructor.
friend friend class Module
virtual void sendSerial(std::string const &str)
void require(char const *info, unsigned int w, unsigned int h, unsigned int f) const
std::string const & stop(double *seconds)
void paste(RawImage const &src, RawImage &dest, int dx, int dy)
void writeText(RawImage &img, std::string const &txt, int x, int y, unsigned int col, Font font=Font6x10)
cv::Mat convertToCvGray(RawImage const &src)
void drawCircle(RawImage &img, int x, int y, unsigned int rad, unsigned int thick, unsigned int col)
std::future< std::invoke_result_t< std::decay_t< Function >, std::decay_t< Args >... > > async(Function &&f, Args &&... args)
unsigned short constexpr White
unsigned short constexpr LightGreen