24#include <opencv2/core/core.hpp>
93 itsArUco = addSubComponent<ArUco>(
"aruco");
94 itsQRcode = addSubComponent<QRcode>(
"qrcode");
110 cv::Mat cvimg = inframe.getCvGRAY();
114 zbar::Image zgray(cvimg.cols, cvimg.rows,
"Y800", cvimg.data, cvimg.total());
116 itsQRcode->sendSerial(
this, zgray, cvimg.cols, cvimg.rows);
117 zgray.set_data(
nullptr, 0);
127 std::vector<int> ids; std::vector<std::vector<cv::Point2f> > corners; std::vector<cv::Vec3d> rvecs, tvecs;
128 itsArUco->detectMarkers(cvimg, ids, corners);
129 if (
itsArUco->dopose::get() && ids.empty() ==
false)
itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
130 itsArUco->sendSerial(
this, ids, corners, cvimg.cols, cvimg.rows, rvecs, tvecs);
147 inimg.
require(
"input", w,
h, V4L2_PIX_FMT_YUYV);
153 outimg = outframe.get();
167 zbar::Image zgray(cvimg.cols, cvimg.rows,
"Y800", cvimg.data, cvimg.total());
171 itsQRcode->drawDetections(outimg, 3,
h + 23, zgray, w,
h, 3);
172 zgray.set_data(
nullptr, 0);
184 std::vector<int> ids; std::vector<std::vector<cv::Point2f> > corners; std::vector<cv::Vec3d> rvecs, tvecs;
185 itsArUco->detectMarkers(cvimg, ids, corners);
186 if (
itsArUco->dopose::get() && ids.empty() ==
false)
itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
189 itsArUco->sendSerial(
this, ids, corners, w,
h, rvecs, tvecs);
191 itsArUco->drawDetections(outimg, 3,
h + 3, ids, corners, rvecs, tvecs);
194 std::string
const & fpscpu = timer.
stop();
215 unsigned short winw, winh;
219 int x = 0, y = 0;
unsigned short iw = 0, ih = 0;
225 helper.
itext(
"JeVois-Pro ArUco + ARtoolkit + QRcode/Barcode Detection");
233 zbar::Image zgray(cvimg.cols, cvimg.rows,
"Y800", cvimg.data, cvimg.total());
246 std::vector<int> ids; std::vector<std::vector<cv::Point2f> > corners; std::vector<cv::Vec3d> rvecs, tvecs;
247 itsArUco->detectMarkers(cvimg, ids, corners);
248 if (
itsArUco->dopose::get() && ids.empty() ==
false)
itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
251 itsArUco->sendSerial(
this, ids, corners, w,
h, rvecs, tvecs);
252 itsArUco->drawDetections(helper, ids, corners, rvecs, tvecs);
259 itsQRcode->drawDetections(helper, zgray, w,
h);
260 zgray.set_data(
nullptr, 0);
266 std::string
const & fpscpu = timer.
stop();
267 helper.
iinfo(inframe, fpscpu, winw, winh);
JEVOIS_REGISTER_MODULE(ArUcoBlob)
Simple demo of QRcode + ARtoolkit + ArUco markers detection and decoding.
std::shared_ptr< QRcode > itsQRcode
virtual void process(jevois::InputFrame &&inframe) override
Processing function, no video output.
virtual void process(jevois::InputFrame &&inframe, jevois::GUIhelper &helper) override
Processing function with GUI output.
std::shared_ptr< ARtoolkit > itsARtoolkit
MarkersCombo(std::string const &instance)
Constructor.
std::shared_ptr< ArUco > itsArUco
virtual ~MarkersCombo()
Virtual destructor for safe inheritance.
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function with video output to USB.
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 require(char const *info, unsigned int w, unsigned int h, unsigned int f) const
StdModule(std::string const &instance)
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 drawFilledRect(RawImage &img, int x, int y, unsigned int w, unsigned int h, 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 Black
unsigned short constexpr White