22#include <opencv2/core/core.hpp>
151 itsArUco = addSubComponent<ArUco>(
"aruco");
170 std::vector<int> ids;
171 std::vector<std::vector<cv::Point2f> > corners;
172 itsArUco->detectMarkers(cvimg, ids, corners);
175 std::vector<cv::Vec3d> rvecs, tvecs;
176 if (
itsArUco->dopose::get() && ids.empty() ==
false)
177 itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
183 itsArUco->sendSerial(
this, ids, corners, w,
h, rvecs, tvecs);
200 inimg.
require(
"input", w,
h, V4L2_PIX_FMT_YUYV);
205 outimg = outframe.get();
214 std::vector<int> ids;
215 std::vector<std::vector<cv::Point2f> > corners;
216 std::vector<cv::Vec3d> rvecs, tvecs;
217 itsArUco->detectMarkers(cvimg, ids, corners);
219 if (
itsArUco->dopose::get() && ids.empty() ==
false)
220 itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
229 itsArUco->drawDetections(outimg, 3,
h+5, ids, corners, rvecs, tvecs);
232 itsArUco->sendSerial(
this, ids, corners, w,
h, rvecs, tvecs);
235 std::string
const & fpscpu = timer.
stop();
251 unsigned short winw, winh;
255 int x = 0, y = 0;
unsigned short iw = 0, ih = 0;
261 helper.
itext(
"JeVois-Pro ArUco Marker Detection");
267 std::vector<int> ids;
268 std::vector<std::vector<cv::Point2f> > corners;
269 std::vector<cv::Vec3d> rvecs, tvecs;
270 itsArUco->detectMarkers(cvimg, ids, corners);
272 if (
itsArUco->dopose::get() && ids.empty() ==
false)
273 itsArUco->estimatePoseSingleMarkers(corners, rvecs, tvecs);
279 itsArUco->drawDetections(helper, ids, corners, rvecs, tvecs);
282 itsArUco->sendSerial(
this, ids, corners, w,
h, rvecs, tvecs);
285 std::string
const & fpscpu = timer.
stop();
286 helper.
iinfo(inframe, fpscpu, winw, winh);
JEVOIS_REGISTER_MODULE(ArUcoBlob)
Simple demo of ArUco and AprilTag augmented reality markers detection and decoding.
virtual void process(jevois::InputFrame &&inframe, jevois::GUIhelper &helper) override
Processing function with zero-copy and GUI on JeVois-Pro.
virtual ~DemoArUco()
Virtual destructor for safe inheritance.
DemoArUco(std::string const &instance)
Constructor.
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function with video output to USB.
std::shared_ptr< ArUco > itsArUco
virtual void process(jevois::InputFrame &&inframe) override
Processing function, no video output.
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