21 #include <opencv2/core/core.hpp>
22 #include <opencv2/imgproc/imgproc.hpp>
32 "This is the size of the image crop that is taken around the most salient "
33 "location in each frame. The foa size must fit within the camera input frame size. To avoid "
34 "rescaling, it is best to use here the size that the deep network expects as input.",
35 cv::Size(128, 128), ParamCateg);
140 public jevois::Parameter<foa>
149 itsSaliency = addSubComponent<Saliency>(
"saliency");
183 int const smfac = (1 << smlev);
189 cv::Size roisiz = foa::get();
itsRw = roisiz.width;
itsRh = roisiz.height;
191 unsigned int const dmx = (mx << smlev) + (smfac >> 2);
192 unsigned int const dmy = (my << smlev) + (smfac >> 2);
198 if (
itsRw <= 0 ||
itsRh <= 0)
LFATAL(
"Ooops, foa size cannot be zero or negative");
219 cv::cvtColor(rawroi, rgbroi, cv::COLOR_YUV2RGB_YUYV);
228 int netinw, netinh, netinc;
itsTensorFlow->getInDims(netinw, netinh, netinc);
235 LINFO(
"Predicted in " << ptime <<
"ms");
240 catch (std::logic_error
const & e) { }
257 inimg.
require(
"input",
w,
h, V4L2_PIX_FMT_YUYV);
262 outimg = outframe.get();
275 jevois::rawimage::drawFilledRect(outimg, w, 0, outimg.width - w, h, jevois::yuyv::Black);
276 jevois::rawimage::writeText(outimg,
"Loading network -", w + 3, 3, jevois::yuyv::White);
277 jevois::rawimage::writeText(outimg,
"please wait...", w + 3, 15, jevois::yuyv::White);
282 if ((jevois::frameNum() & 1) == 0 ||
itsRw == 0)
295 cv::cvtColor(rawroi, rgbroi, cv::COLOR_YUV2RGB_YUYV);
305 int netinw, netinh, netinc;
itsTensorFlow->getInDims(netinw, netinh, netinc);
313 cv::Size displaysize(outimg.
width -
w,
int(rgbroi.rows * fac + 0.4999F));
324 paste_fut.get(); scale_fut.get();
335 int y = disph + 3;
if (y +
itsTensorFlow->top::get() * 12 >
h - 21) y = 3;
340 w + 3, y, jevois::yuyv::White);
349 w + 3,
h - 11, jevois::yuyv::White);
361 std::string
const & fpscpu = timer.
stop();