30 cv::Size(2, 2), ParamCateg);
56 public jevois::Parameter<grid>
62 using StdModule::StdModule;
80 pipe->process(inimg,
this, outimg, helper, idle);
107 std::string
const & fpscpu = timer.
stop();
111 unsigned short winw, winh;
116 cv::Size
const g = grid::get();
117 if (g.width == 0 || g.height == 0)
LFATAL(
"Cannot handle zero rows or columns of models");
118 unsigned int totw = img.
width * g.width, toth = img.
height * g.height;
120 int const xoff = (winw - totw) / 2;
121 int const yoff = (winh - toth) / 2;
122 unsigned short iw = totw / g.width;
123 unsigned short ih = toth / g.height;
126 int x = xoff, y = yoff;
int n = 0;
131 helper.
drawInputFrame((std::to_string(n)+
"c").c_str(), inframe, x, y, iw, ih,
true);
134 doprocess(pipe, inframe,
nullptr, &helper, idle);
137 ++n; x += iw;
if (x >
int(totw) - iw/2) { x = xoff; y += ih; }
141 helper.
iinfo(inframe, fpscpu, winw, winh);
153 size_t const num = newval.width * newval.height;
154 if (num == 0)
LFATAL(
"Cannot handle zero rows or columns of models");
157 itsPipes.emplace_back(addSubComponent<jevois::dnn::Pipeline>(
"p"+std::to_string(
itsPipes.size())));
162 std::vector<std::shared_ptr<jevois::dnn::Pipeline>>
itsPipes;
JEVOIS_REGISTER_MODULE(ArUcoBlob)
#define JEVOIS_UNUSED_PARAM(x)
Run multiple neural networks in parallel with a tiled display.
void onParamChange(grid const &JEVOIS_UNUSED_PARAM(param), cv::Size const &newval) override
virtual ~MultiDNN()
Virtual destructor for safe inheritance.
void doprocess(std::shared_ptr< jevois::dnn::Pipeline > pipe, jevois::InputFrame const &inframe, jevois::RawImage *outimg, jevois::OptGUIhelper *helper, bool idle)
Processing function implementation.
std::vector< std::shared_ptr< jevois::dnn::Pipeline > > itsPipes
virtual void process(jevois::InputFrame &&inframe, jevois::GUIhelper &helper) override
Processing function, no video output.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(grid, cv::Size, "Grid of networks to run and display", cv::Size(2, 2), ParamCateg)
Parameter.
void removeSubComponent(std::shared_ptr< Comp > &component)
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)
std::string const & stop(double *seconds)
void applyLetterBox(unsigned int &imw, unsigned int &imh, unsigned int const winw, unsigned int const winh, bool noalias)