JeVois  1.21
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
Module.H
Go to the documentation of this file.
1// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2//
3// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5//
6// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10// License for more details. You should have received a copy of the GNU General Public License along with this program;
11// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12//
13// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16/*! \file */
17
18#pragma once
19
24#include <jevois/Core/UserInterface.H> // not strictly needed but derived classes will want to use it
28#include <jevois/Types/Enum.H>
29#include <opencv2/core/core.hpp>
30#include <memory>
31#include <ostream>
32
33#ifdef JEVOIS_PRO
34#include <jevois/GPU/GUIhelper.H> // not strictly required but derived classes may want to use it
35#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
36#endif
37
38namespace jevois
39{
40 class VideoOutput;
41 class Engine;
42
43 //! Virtual base class for a vision processing module
44 /*! Module is the base class to implement camera-to-USB frame-by-frame video processing. The Engine instantiates one
45 class derived from Module, according to the current VideoMapping selected by the end user (e.g., current image
46 resolution, format, and frame rate setected by a webcam viewing program on a host computer). The Module is loaded
47 as shared object (.so) file according to the VideoMapping definitions in videomappings.cfg and the current
48 VideoMapping selected by the user.
49
50 Module derives from Component and as such can contain:
51
52 - any number of Parameter settings
53
54 - any arbitrarily complex sub-hierarchy of Component objects to implement various functionality. Parameter
55 settings from all the sub-components are available to the Module and to users connected over Serial ports of the
56 Engine.
57
58 This allows one to implement complex vision processing pipelines efficiently and with substantial code re-use. For
59 example, one may first want to implement an EdgeDetector or Saliency component, with Parameter settings for
60 various thresholds, features, etc. One can then create any number of top-level objects that derive from Module and
61 that may contain one or more EdgeDetector, Saliency, etc components in their hierarchy of sub-components, with the
62 implementation in the module simply routing images from one Component to another to create a processing pipeline.
63
64 Classes that derive from Module should implement up to four functions:
65
66 - process(InputFrame && inframe, OutputFrame && outframe) is called once per iteration of the Engine main loop
67 when the current VideoMapping specifies both a particular Camera resolution and format, and a USB resolution and
68 format. This function should process the received input frame and fill the pixel buffer of the output frame with
69 results. Memory has already been allocated for both the input and output images before process() is
70 called. Because the output image is actually allocated by the USB Gadget driver (and, ultimately, by the Linux
71 kernel), its pixel memory location cannot be moved (hence, do not attempt to copy the output image or replace it
72 by another image, etc; just write pixel data into the output image's pixel array). There is no restriction on
73 video modes or frame rates, except as suported by the Camera hardware, and as limited by USB bandwidth. For most
74 implementations, matching the input and output frame rate is easiest, and means that each invocation of
75 process() would access and use both of the provided InputFrame and OutputFrame (one-input-to-one-output
76 processing pipeline). But this is not mandatory. For example, a motion flow computation Module for use in a
77 flying drone may have 320x240 YUYV 53.0fps inputs and 100x142 GREY 10.6fps output (since output frame rate is 5x
78 lower than input in this example, the process() function would here get, fill, and send the OutputFrame only
79 once every 5 times it is called; implementation of the process() function should keep track of that, e.g.,
80 through a member variable that gets incremented each time process() is called). In addition to filling the pixel
81 data of the OutputFrame, process() may also send results over the serial ports (e.g., for use by an Arduino
82 connected to the JeVois platform hardware) using sendSerial().
83
84 - process(InputFrame && inframe) is called once per Camera frame when the current VideoMapping specifies a
85 particular Camera resolution and format, and NONE as USB output format. This function should process the
86 received input frame and would typicaly then send results to serial ports (e.g., for use by an Arduino connected
87 to the JeVois platform hardware) using sendSerial(). There is no restriction on video modes or frame rates,
88 except as suported by the Camera hardware.
89
90 - parseSerial(std::string const & str, std::shared_ptr<UserInterface> s) allows the Module to support custom user
91 commands. Engine will forward to this function any command received over Serial or other UserInterface that it
92 does not understand. You should use this for things that go beyond Parameter settings (which is already natively
93 supported by Engine) or built-in commands of Engine (see \ref UserCli). For example, one could implement here a
94 command called "start" to allow users to start some specific thing.
95
96 - supportedCommands(std::ostream & os) should stream out a human-readable description of any custom commands
97 supported by parseSerial(). These will be shown to users when they type "help" over a Serial port.
98
99 \note Every module implementation file should contain a call to #JEVOIS_REGISTER_MODULE(MODULENAME) for the
100 module's class. This creates some plain-C entry points that will be used when the module is loaded from a dynamic
101 library (.so) file to instantiate the module. See \ref ModuleTutorial for examples.
102
103 \ingroup core */
104 class Module : public Component
105 {
106 public:
107 //! Constructor
108 /*! the instance is a user-defined string that may be used to differentiate between several instances of the
109 same module. */
110 Module(std::string const & instance);
111
112 //! Virtual destructor for safe inheritance
113 virtual ~Module();
114
115 //! Processing function, version that receives a frame from camera and sends a frame out over USB
116 /*! This function is called once for each grabbed video frame from the camera, and it should complete within the
117 camera's frame period in order to avoid dropping frames. The InputFrame and OutputFrame objects are simple
118 wrappers to ensure that the low-level video buffers will always be returned to the low-level camera and USB
119 drivers even if the process function throws at any point during the processing. If any error occurs, it is
120 hence ok to throw from within process() at any time, just make sure your locally allocated resources will be
121 freed, which is usually best achieved by using shared_ptr and similar wrappers around them. The Engine (which
122 calls process() on your module for every frame) will catch any exception an proceed to the next frame.
123
124 Default implementation in the base class just throws. Derived classes should override it. */
125 virtual void process(InputFrame && inframe, OutputFrame && outframe);
126
127 //! Processing function, version that receives a frame from camera and does not use USB
128 /*! This function is called once for each grabbed video frame from the camera, and it should complete within the
129 camera's frame period in order to avoid dropping frames. The InputFrame object is a simple wrapper to ensure
130 that the low-level video buffers will always be returned to the low-level camera driver even if the process
131 function throws at any point during the processing. If any error occurs, it is hence ok to throw from within
132 process() at any time, just make sure your locally allocated resources will be freed, which is usually best
133 achieved by using shared_ptr and similar wrappers around them. The Engine (which calls process() on your
134 module for every frame) will catch any exception an proceed to the next frame.
135
136 Default implementation in the base class just throws. Derived classes should override it. */
137 virtual void process(InputFrame && inframe);
138
139#ifdef JEVOIS_PRO
140 //! Processing function, version that receives a frame from camera, no USB, but GUI output on JeVois-Pro
141 /*! This function is called once for each grabbed video frame from the camera, and it should complete within the
142 camera's frame period in order to avoid dropping frames. The InputFrame object is a simple wrapper to ensure
143 that the low-level video buffers will always be returned to the low-level camera driver even if the process
144 function throws at any point during the processing. If any error occurs, it is hence ok to throw from within
145 process() at any time, just make sure your locally allocated resources will be freed, which is usually best
146 achieved by using shared_ptr and similar wrappers around them. The Engine (which calls process() on your
147 module for every frame) will catch any exception an proceed to the next frame.
148
149 Default implementation in the base class just throws. Derived classes should override it. */
150 virtual void process(InputFrame && inframe, GUIhelper & helper);
151#endif
152
153 //! Send a string over the 'serout' serial port
154 /*! The default implementation just sends the string to the serial port specified by the 'serout' Parameter in
155 Engine (which could be the hardware serial port, the serial-over-USB port, both, or none; see \ref UserCli for
156 information about \c serout). No need to override in most cases. Typically, you would use this function from
157 within process() to send out some results of your processing.
158
159 Note that the default 'serout' Parameter setting in Engine is None. This is to allow users to configure
160 parameters, get parameter values, possibly read the help message, etc before the flow of serial outputs from
161 vision processing starts. Once ready to receive serial outputs, one would typically issue a command 'setpar
162 serout Hard' over the JeVois command line to enable serial outputs to the hardware serial port. An Arduino
163 would issue that setpar commands when it is ready to work. See ArduinoTutorial for an example. */
164 virtual void sendSerial(std::string const & str);
165
166 //! Receive a string from a serial port which contains a user command
167 /*! This function may be called in between calls to process() with any received string from any of the serial
168 ports. Some commands are parsed upstream already (like "help", set param value, set camera control, etc; see
169 the Engine class) and will not be received here. Only the ones not recognized by the Engine will be received
170 (i.e., custom commands specific to your module).
171
172 The default implementation just throws std::runtime_error("Unsupported command"), but some modules may want to
173 override this function to handle custom commands. If you successfully process the command, just return;
174 otherwise, throw, and if your exception derives from std::exception, the Engine will append its what() to the
175 error message issued to the user. When you support commands here, you should update the implementation of
176 supportedCommands() to provide some description of those commands to the users.
177
178 The \c s parameter is the serial port that received the command. You can send any results back to that port
179 using writeString() on it. Note that the Engine will automatically add the 'OK' message upon success, so you
180 do not have to send that here. */
181 virtual void parseSerial(std::string const & str, std::shared_ptr<UserInterface> s);
182
183 //! Human-readable description of this Module's supported custom commands
184 /*! The format here is free. Just use std::endl to demarcate lines, these will be converted to the appropriate
185 line endings by the serial ports. Default implementation writes "None" to os. */
186 virtual void supportedCommands(std::ostream & os);
187 };
188
189 namespace modul
190 {
191 static ParameterCategory const ParamCateg("Module Serial Message Options");
192
193 //! Enum for Parameter \relates jevois::StdModule
194 JEVOIS_DEFINE_ENUM_CLASS(SerStyle, (Terse) (Normal) (Detail) (Fine) );
195
196 //! Parameter \relates jevois::StdModule
197 JEVOIS_DECLARE_PARAMETER(serstyle, SerStyle, "Style for standardized serial messages as defined in "
198 "http://jevois.org/doc/UserSerialStyle.html",
199 SerStyle::Terse, SerStyle_Values, ParamCateg);
200
201 //! Parameter \relates jevois::StdModule
202 JEVOIS_DECLARE_PARAMETER(serprec, unsigned int, "Number of decimal points in standardized serial messages as "
203 "defined in http://jevois.org/doc/UserSerialStyle.html",
204 0U, jevois::Range<unsigned int>(0U, 10U), ParamCateg);
205
206 //! Enum for Parameter \relates jevois::StdModule
207 JEVOIS_DEFINE_ENUM_CLASS(SerStamp, (None) (Frame) (Time) (FrameTime) (FrameDateTime) );
208
209 //! Parameter \relates jevois::StdModule
210 JEVOIS_DECLARE_PARAMETER(serstamp, SerStamp, "Prepend standardized serial messages with a frame number, "
211 "time, frame+time, or frame+date+time. See details in "
212 "http://jevois.org/doc/UserSerialStyle.html",
213 SerStamp::None, SerStamp_Values, ParamCateg);
214
215 //! Enum for Parameter \relates jevois::StdModule
216 JEVOIS_DEFINE_ENUM_CLASS(SerMark, (None) (Start) (Stop) (Both) );
217
218 //! Parameter \relates jevois::StdModule
219 JEVOIS_DECLARE_PARAMETER(sermark, SerMark, "Send serial message to mark the beginning (MARK START) of the "
220 "processing of a video frame from the camera sensor, the end (MARK STOP), or both. "
221 "Useful, among others, if one needs to know when no results were sent over serial "
222 "on a given frame. Combine with parameter serstamp if you need to know the frame number.",
223 SerMark::None, SerMark_Values, ParamCateg);
224 }
225
226 //! Base class for a module that supports standardized serial messages
227 /*! Modules that can output standardized serial messages should derive from StdModule instead of Module. StdModule
228 brings in extra parameters to set serial message style and precision, and extra member functions to assemble,
229 format, and send standardized serial messages. The process(), sendSerial(), parseSerial(), supportedCommands(),
230 etc of StdModule functions are directly inherited from Module. See \ref UserSerialStyle for standardized serial
231 messages. \ingroup core */
232 class StdModule : public Module,
233 public Parameter<modul::serprec, modul::serstyle, modul::serstamp, modul::sermark>
234 {
235 public:
236 //! Constructor
237 /*! the instance is a user-defined string that may be used to differentiate between several instances of the
238 same module. */
239 StdModule(std::string const & instance);
240
241 //! Virtual destructor for safe inheritance
242 virtual ~StdModule();
243
244 //! Send standardized 1D message for an X image coordinate
245 /*! See \ref UserSerialStyle for more info. Coordinates should be in camera image pixels, this function will
246 convert them to standardized coordinates as per \ref coordhelpers. */
247 void sendSerialImg1Dx(unsigned int camw, float x, float size = 0.0F, std::string const & id = "",
248 std::string const & extra = "");
249
250 //! Send standardized 1D message for a standardized X coordinate
251 /*! See \ref UserSerialStyle for more info. Coordinates should be in camera image pixels, this function will
252 convert them to standardized coordinates as per \ref coordhelpers. */
253 void sendSerialStd1Dx(float x, float size = 0.0F, std::string const & id = "", std::string const & extra = "");
254
255 //! Send standardized 1D message for an Y image coordinate
256 /*! See \ref UserSerialStyle for more info. Coordinates should be in camera image pixels, this function will
257 convert them to standardized coordinates as per \ref coordhelpers. */
258 void sendSerialImg1Dy(unsigned int camh, float y, float size = 0.0F, std::string const & id = "",
259 std::string const & extra = "");
260
261 //! Send standardized 1D message for a standardized Y coordinate
262 /*! See \ref UserSerialStyle for more info. Coordinates should be in camera image pixels, this function will
263 convert them to standardized coordinates as per \ref coordhelpers. */
264 void sendSerialStd1Dy(float y, float size = 0.0F, std::string const & id = "", std::string const & extra = "");
265
266 //! Send standardized 2D message for image coordinates
267 /*! Use this function if you only know location and optionally size. Use the other variants if you have the
268 corners. An upright rectangular shape will be assumed here. See \ref UserSerialStyle for more
269 info. Coordinates should be in camera image pixels, this function will convert them to standardized
270 coordinates as per \ref coordhelpers. */
271 void sendSerialImg2D(unsigned int camw, unsigned int camh, float x, float y, float w = 0.0F, float h = 0.0F,
272 std::string const & id = "", std::string const & extra = "");
273
274 //! Send standardized 2D message for standardized coordinates
275 /*! Use this function if you only know location and optionally size. Use the other variants if you have the
276 corners. An upright rectangular shape will be assumed here. See \ref UserSerialStyle for more
277 info. Coordinates should be in camera image pixels, this function will convert them to standardized
278 coordinates as per \ref coordhelpers. */
279 void sendSerialStd2D(float x, float y, float w = 0.0F, float h = 0.0F,
280 std::string const & id = "", std::string const & extra = "");
281
282 //! Send standardized 2D message for polygons in image coordinates
283 /*! Use this function if you have a polygon around your object, for example, one of the contours found with
284 cv::findContours(), or if you have the 4 corners of a rectangular object. See \ref UserSerialStyle for more
285 info. Coordinates should be in camera image pixels, this function will convert them to standardized
286 coordinates as per \ref coordhelpers. For \b Terse serial style, the center of gravity of the points will be
287 computed and output; for \b Normal, an upright bounding rectangle will be computed and output; for \b
288 Detailed, a rotated bounding rectangle will be computed and output; for \b Fine, all the given points will
289 be output. Make sure you try to reduce the number of points so the message is not too long; for example see
290 OpenCV approxPolyDP() or similar. */
291 template <typename T = int>
292 void sendSerialContour2D(unsigned int camw, unsigned int camh, std::vector<cv::Point_<T> > points,
293 std::string const & id = "", std::string const & extra = "");
294
295 //! Send standardized 3D message
296 /*! Use this function if you only know location and optionally size and an orientation quaternion. Use the other
297 variants if you have a bunch of vertices. See \ref UserSerialStyle for more info. Coordinates should be in
298 millimeters. */
299 void sendSerialStd3D(float x, float y, float z, float w = 0.0F, float h = 0.0F, float d = 0.0F,
300 float q1 = 0.0F, float q2 = 0.0F, float q3 = 0.0f, float q4 = 0.0F,
301 std::string const & id = "", std::string const & extra = "");
302
303 //! Send standardized 3D message
304 /*! Use this function if you only know location and optionally size and an orientation quaternion. Use the other
305 variants if you have a bunch of vertices. See \ref UserSerialStyle for more info. Coordinates should be in
306 millimeters. */
307 void sendSerialStd3D(std::vector<cv::Point3f> points, std::string const & id = "",
308 std::string const & extra = "");
309
310 //! Send a standardized object recognition message
311 /*! res should be a list of scores and category names, in descending order of scores. Note that no message
312 is sent if the vector is empty. */
313 void sendSerialObjReco(std::vector<ObjReco> const & res);
314
315 //! Send a standardized object detection + recognition message
316 /*! res should be a list of scores and category names, in descending order of scores. Note that no message
317 is sent if the vector is empty. See sendSerialImg2D() for info about the object box. */
318 void sendSerialObjDetImg2D(unsigned int camw, unsigned int camh, float x, float y, float w, float h,
319 std::vector<ObjReco> const & res);
320
321 //! Send a standardized object detection + recognition message
322 /*! res should be a list of scores and category names, in descending order of scores. Note that no message
323 is sent if the vector is empty. See sendSerialImg2D() for info about the object box. */
324 void sendSerialObjDetImg2D(unsigned int camw, unsigned int camh, ObjDetect const & det);
325
326 protected:
327 friend class jevois::Engine;
328
329 //! Send a message <b>MARK START</b> to indicate the beginning of processing
330 /*! A stamp may be prepended depending on param \p serstamp. Engine calls this automatically so users would
331 normally not use this function. Note that this function may not send anything depending on the current
332 value of parameter \p sermark. */
333 void sendSerialMarkStart();
334
335 //! Send a message <b>MARK STOP</b> to indicate the end of processing
336 /*! A stamp may be prepended depending on param \p serstamp. Engine calls this automatically so users would
337 normally not use this function. Note that this function may not send anything depending on the current
338 value of parameter \p sermark. */
339 void sendSerialMarkStop();
340
341 //! Get a string with the frame/date/time stamp in it, depending on serstamp parameter
342 std::string getStamp() const;
343 };
344}
345
346//! Register a module, allowing it to be dynamically loaded from a .so file
347/* \def JEVOIS_REGISTER_MODULE(MODULENAME)
348 \hideinitializer
349
350 Every module implementation file should contain a call to JEVOIS_REGISTER_MODULE for the module's class. This creates
351 some plain-C entry points that will be used when the module is loaded from a dynamic library (.so) file to
352 instantiate the module. \relates Module */
353#define JEVOIS_REGISTER_MODULE(MODULENAME) \
354 extern "C" std::shared_ptr<jevois::Module> MODULENAME##_create(std::string const & instanceid) \
355 { return std::shared_ptr<jevois::Module>(new MODULENAME(instanceid)); } \
356 extern "C" int MODULENAME##_version_major() { return JEVOIS_VERSION_MAJOR; } \
357 extern "C" int MODULENAME##_version_minor() { return JEVOIS_VERSION_MINOR; } \
358
359//! Create and register a disabled module, allowing it to be dynamically loaded from a .so file
360/* \def JEVOIS_DISABLED_MODULE(MODULENAME)
361 \hideinitializer
362
363 Use this macro when creating modules that only work on a given host/platform A33/Pro configuration. For example,
364 modules using the A311D NPU can only be compiled on jevois-pro platform. Typically, you would then do:
365 \code
366#include <jevois/Core/Module.H>
367
368#ifdef JEVOIS_PLATFORM_PRO
369 class MyModule { ... };
370
371 JEVOIS_REGISTER_MODULE(MyModule);
372#else
373 JEVOIS_DISABLED_MODULE(MyModule);
374#endif
375 \endcode
376 \relates Module */
377#define JEVOIS_DISABLED_MODULE(MODULENAME) \
378 class MODULENAME : public jevois::Module { \
379 public: \
380 MODULENAME(std::string const & instancename) : jevois::Module(instancename) \
381 { throw std::runtime_error("This module is disabled on your hardware configuration"); } \
382 }; \
383 extern "C" std::shared_ptr<jevois::Module> MODULENAME##_create(std::string const & instanceid) \
384 { return std::shared_ptr<jevois::Module>(new MODULENAME(instanceid)); } \
385 extern "C" int MODULENAME##_version_major() { return JEVOIS_VERSION_MAJOR; } \
386 extern "C" int MODULENAME##_version_minor() { return JEVOIS_VERSION_MINOR; } \
387
int h
Definition GUIhelper.C:2491
A component of a model hierarchy.
Definition Component.H:182
friend class Module
Definition Component.H:515
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
Definition Engine.H:414
Helper class to assist modules in creating graphical and GUI elements.
Definition GUIhelper.H:133
Exception-safe wrapper around a raw camera input frame.
Definition InputFrame.H:51
Virtual base class for a vision processing module.
Definition Module.H:105
virtual void sendSerial(std::string const &str)
Send a string over the 'serout' serial port.
Definition Module.C:54
virtual void supportedCommands(std::ostream &os)
Human-readable description of this Module's supported custom commands.
Definition Module.C:67
virtual void parseSerial(std::string const &str, std::shared_ptr< UserInterface > s)
Receive a string from a serial port which contains a user command.
Definition Module.C:63
virtual ~Module()
Virtual destructor for safe inheritance.
Definition Module.C:36
virtual void process(InputFrame &&inframe, OutputFrame &&outframe)
Processing function, version that receives a frame from camera and sends a frame out over USB.
Definition Module.C:40
Exception-safe wrapper around a raw image to be sent over USB.
Definition OutputFrame.H:53
A generic range class.
Definition Range.H:81
Base class for a module that supports standardized serial messages.
Definition Module.H:234
void sendSerialStd1Dx(float x, float size=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 1D message for a standardized X coordinate.
Definition Module.C:138
void sendSerialObjDetImg2D(unsigned int camw, unsigned int camh, float x, float y, float w, float h, std::vector< ObjReco > const &res)
Send a standardized object detection + recognition message.
Definition Module.C:572
virtual ~StdModule()
Virtual destructor for safe inheritance.
Definition Module.C:77
JEVOIS_DECLARE_PARAMETER(sermark, SerMark, "Send serial message to mark the beginning (MARK START) of the " "processing of a video frame from the camera sensor, the end (MARK STOP), or both. " "Useful, among others, if one needs to know when no results were sent over serial " "on a given frame. Combine with parameter serstamp if you need to know the frame number.", SerMark::None, SerMark_Values, ParamCateg)
Parameter.
JEVOIS_DEFINE_ENUM_CLASS(SerStyle,(Terse)(Normal)(Detail)(Fine))
Enum for Parameter.
JEVOIS_DEFINE_ENUM_CLASS(SerMark,(None)(Start)(Stop)(Both))
Enum for Parameter.
std::string getStamp() const
Get a string with the frame/date/time stamp in it, depending on serstamp parameter.
Definition Module.C:81
void sendSerialStd3D(float x, float y, float z, float w=0.0F, float h=0.0F, float d=0.0F, float q1=0.0F, float q2=0.0F, float q3=0.0f, float q4=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 3D message.
Definition Module.C:385
void sendSerialObjReco(std::vector< ObjReco > const &res)
Send a standardized object recognition message.
Definition Module.C:535
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="")
Send standardized 2D message for image coordinates.
Definition Module.C:221
void sendSerialStd1Dy(float y, float size=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 1D message for a standardized Y coordinate.
Definition Module.C:186
void sendSerialMarkStop()
Send a message MARK STOP to indicate the end of processing.
Definition Module.C:527
JEVOIS_DEFINE_ENUM_CLASS(SerStamp,(None)(Frame)(Time)(FrameTime)(FrameDateTime))
Enum for Parameter.
JEVOIS_DECLARE_PARAMETER(serstamp, SerStamp, "Prepend standardized serial messages with a frame number, " "time, frame+time, or frame+date+time. See details in " "http://jevois.org/doc/UserSerialStyle.html", SerStamp::None, SerStamp_Values, ParamCateg)
Parameter.
void sendSerialStd2D(float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 2D message for standardized coordinates.
Definition Module.C:234
JEVOIS_DECLARE_PARAMETER(serstyle, SerStyle, "Style for standardized serial messages as defined in " "http://jevois.org/doc/UserSerialStyle.html", SerStyle::Terse, SerStyle_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serprec, unsigned int, "Number of decimal points in standardized serial messages as " "defined in http://jevois.org/doc/UserSerialStyle.html", 0U, jevois::Range< unsigned int >(0U, 10U), ParamCateg)
Parameter.
void sendSerialImg1Dx(unsigned int camw, float x, float size=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 1D message for an X image coordinate.
Definition Module.C:124
void sendSerialImg1Dy(unsigned int camh, float y, float size=0.0F, std::string const &id="", std::string const &extra="")
Send standardized 1D message for an Y image coordinate.
Definition Module.C:173
void sendSerialMarkStart()
Send a message MARK START to indicate the beginning of processing.
Definition Module.C:519
void sendSerialContour2D(unsigned int camw, unsigned int camh, std::vector< cv::Point_< T > > points, std::string const &id="", std::string const &extra="")
Send standardized 2D message for polygons in image coordinates.
Definition Module.C:284
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2
A trivial struct to store object detection results.
Definition ObjDetect.H:27
A category to which multiple ParameterDef definitions can belong.