27#include <opencv2/core/core.hpp>
28#include <opencv2/imgproc/imgproc.hpp>
31#include <linux/videodev2.h>
88 itsSaliency = addSubComponent<Saliency>(
"saliency");
89 itsKF = addSubComponent<Kalman2D>(
"kalman");
100 inimg.
require(
"input", w,
h, V4L2_PIX_FMT_YUYV);
129 int const smfac = (1 << smlev);
130 int const roihw = (smfac * 3) / 2;
131 int const mapdrawfac = smfac / 4;
132 int const mapdw = (w >> smlev) * mapdrawfac;
133 int const mapdh = (
h >> smlev) * mapdrawfac;
136 outimg.require(
"output", w + (w & ~(smfac-1)),
h + mapdh, V4L2_PIX_FMT_YUYV);
142 unsigned int const dmx = (mx << smlev) + (smfac >> 2);
143 unsigned int const dmy = (my << smlev) + (smfac >> 2);
144 int rx = std::min(
int(w) - roihw, std::max(roihw,
int(dmx + 1 + smfac/4)));
145 int ry = std::min(
int(
h) - roihw, std::max(roihw,
int(dmy + 1 + smfac/4)));
151 itsKF->set(dmx, dmy, w,
h);
152 float kfxraw, kfyraw, kfximg, kfyimg;
153 itsKF->get(kfxraw, kfyraw, kfximg, kfyimg, inimg.
width, inimg.
height, 1.0F, 1.0F);
190 unsigned int const gw = outimg.width - dx, gh = outimg.height -
h;
194 unsigned int const gscale = int(sqrt((gw * gh) /
itsSaliency->gist_size));
JEVOIS_REGISTER_MODULE(ArUcoBlob)
void drawGist(jevois::RawImage &img, unsigned char const *gist, size_t gistsize, unsigned int xoff, unsigned int yoff, unsigned int width, unsigned int scale)
void drawMap(jevois::RawImage &img, env_image const *fmap, unsigned int xoff, unsigned int yoff, unsigned int scale)
Simple demo of the visual saliency algorithm of Itti et al., IEEE PAMI, 1998.
std::shared_ptr< Saliency > itsSaliency
virtual void process(jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
Processing function.
virtual ~DemoSaliency()
Virtual destructor for safe inheritance.
DemoSaliency(std::string const &instance)
Constructor.
std::shared_ptr< Kalman2D > itsKF
void require(char const *info, unsigned int w, unsigned int h, unsigned int f) const
void sendSerialImg2D(unsigned int camw, unsigned int camh, float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
StdModule(std::string const &instance)
std::string const & stop(double *seconds)
ENV_INTG32_TYPE intg32
32-bit signed integer
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)
void drawFilledRect(RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int col)
void drawRect(RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int thick, unsigned int col)
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