JeVois  1.21
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
Engine.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
22#include <jevois/Types/Enum.H>
26
27#include <memory>
28#include <mutex>
29#include <vector>
30#include <list>
31#include <atomic>
32
33// #################### Platform mode config:
34#ifdef JEVOIS_PLATFORM
35
36#if defined(JEVOIS_A33)
37// ########## JeVois-A33 platform:
38
39// On the JeVois-A33 platform, we use a gadget driver by default to send output frames over USB, one hardware serial
40// driver, and one serial-over-USB driver:
41
42//! On platform hardware, device for the camera sensor
43#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
44
45//! On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host computer)
46#define JEVOIS_GADGET_DEFAULT "/dev/video1"
47
48//! On platform hardware, device for the 4-pin hardware serial port
49#define JEVOIS_SERIAL_DEFAULT "/dev/ttyS0"
50
51//! On platform hardware, device for serial-over-USB port
52#define JEVOIS_USBSERIAL_DEFAULT "/dev/ttyGS0"
53
54//! Default camera sensor
55#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::ov9650
56
57//! Default IMU spi device
58#define JEVOIS_IMUSPI_DEFAULT ""
59
60#elif defined(JEVOIS_PRO)
61// ########## JeVois-Pro platform:
62
63// On the JeVois-Pro platform, we have no gadget for now (which will trigger displaying output frames to a window), one
64// hardware serial driver, and not yet one serial-over-USB driver:
65
66//! On platform hardware, device for the camera sensor
67#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
68
69//! On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host computer)
70#define JEVOIS_GADGET_DEFAULT ""
71
72//! On platform hardware, device for the 4-pin hardware serial port
73#define JEVOIS_SERIAL_DEFAULT "/dev/ttyS4"
74
75//! On platform hardware, device for serial-over-USB port
76#define JEVOIS_USBSERIAL_DEFAULT ""
77//#define JEVOIS_USBSERIAL_DEFAULT "/dev/ttyGS0"
78
79//! Default camera sensor
80#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::any
81
82//! Default IMU spi device
83#define JEVOIS_IMUSPI_DEFAULT "/dev/spidev32766.0"
84
85#else
86#error "Neither JEVOIS_A33 nor JEVOIS_PRO defined -- ABORT"
87#endif
88
89#else // JEVOIS_PLATFORM
90// #################### Host mode config:
91
92// On the host, we have no gadget (which will trigger displaying output frames to a window) and we use the terminal in
93// which jevois-daemon was started for serial commands:
94
95//! On generic computer hardware, device for the camera sensor
96#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
97
98//! On generic computer hardware, device for the USB gadget driver should always be empty
99#define JEVOIS_GADGET_DEFAULT ""
100
101//! On generic computer hardware, device for serial port should always be stdio to use an StdioInterface
102#define JEVOIS_SERIAL_DEFAULT "stdio"
103
104//! On generic computer hardware, device for the serial-over-USB port should always be empty
105#define JEVOIS_USBSERIAL_DEFAULT ""
106
107//! Default IMU spi device
108#define JEVOIS_IMUSPI_DEFAULT ""
109
110#ifdef JEVOIS_PRO
111//! Default camera sensor
112#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::imx290
113#else
114//! Default camera sensor
115#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::ov9650
116#endif
117
118#endif // JEVOIS_PLATFORM
119
120namespace jevois
121{
122 class VideoInput;
123 class VideoOutput;
124 class Module;
125 class DynamicLoader;
126 class UserInterface;
127 class GUIhelper;
128 class GUIconsole;
129 class Camera;
130 class IMU;
131
132 //! Parameters of the Engine class
133 namespace engine
134 {
135 static ParameterCategory const ParamCateg("Engine Options");
136
137 //! Parameter \relates jevois::Engine
138 JEVOIS_DECLARE_PARAMETER(cameradev, std::string, "Camera device name (if starting with /dev/v...), or movie "
139 "file name (e.g., movie.mpg) or image sequence (e.g., im%02d.jpg, to read frames "
140 "im00.jpg, im01.jpg, etc).",
141 JEVOIS_CAMERA_DEFAULT, ParamCateg);
142
143 //! Parameter \relates jevois::Engine
144 JEVOIS_DECLARE_PARAMETER(camerasens, CameraSensor, "Camera sensor. Users would usually not set this parameter "
145 "manually, it is set through boot-time configuration.",
146 JEVOIS_CAMERASENS_DEFAULT, CameraSensor_Values, ParamCateg);
147
148 //! Parameter \relates jevois::Engine
149 JEVOIS_DECLARE_PARAMETER(cameralens, CameraLens, "Camera lens. Users should usually not set this parameter "
150 "using the global JeVois params.cfg config file.",
151 CameraLens::standard, CameraLens_Values, ParamCateg);
152
153 JEVOIS_DECLARE_PARAMETER(imudev, std::string, "IMU SPI device name, typically starting with /dev/spidev..., "
154 "or empty if device does not have an IMU with SPI interface.",
155 JEVOIS_IMUSPI_DEFAULT, ParamCateg);
156
157 //! Parameter \relates jevois::Engine
158 JEVOIS_DECLARE_PARAMETER(cameranbuf, unsigned int, "Number of video input (camera) buffers, or 0 for automatic.",
159 0, ParamCateg);
160
161 //! Parameter \relates jevois::Engine
162 JEVOIS_DECLARE_PARAMETER(gadgetdev, std::string, "Gadget device name. This is used on platform hardware only. "
163 "On host hardware, a display window will be used unless gadgetdev is None (useful "
164 "for benchmarking) or is a file stem for a movie file that does not start with /dev/ "
165 "(and which should contain a printf-style directive for a single int argument, "
166 "the movie number).",
167 JEVOIS_GADGET_DEFAULT, ParamCateg);
168
169 //! Parameter \relates jevois::Engine
170 JEVOIS_DECLARE_PARAMETER(gadgetnbuf, unsigned int, "Number of video output (USB video) buffers, or 0 for auto",
171 0, ParamCateg);
172
173 //! Parameter \relates jevois::Engine
174 JEVOIS_DECLARE_PARAMETER(videomapping, int, "Index of Video Mapping to use, or -1 to use the default mapping. "
175 "Note that this parameter is only available when parsing command-line arguments. "
176 "At runtime, the setmapping command should be used instead.",
177 -1, ParamCateg);
178
179#ifdef JEVOIS_PRO
180 //! Parameter \relates jevois::Engine
181 JEVOIS_DECLARE_PARAMETER(serialmonitors, bool, "If true, serial port monitors will be enabled "
182 "in the GUI, which can be used to peek at serial communications not "
183 "directed to the console. Can be turned off at start time (e.g., in the "
184 "global JeVois params.cfg) as there is some small CPU cost to it.",
185 true, ParamCateg);
186#endif
187
188 //! Parameter \relates jevois::Engine
189 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(serialdev, std::string, "Hardware (4-pin connector) serial device name, "
190 "or 'stdio' to use the console, or empty for no hardware serial port",
191 JEVOIS_SERIAL_DEFAULT, ParamCateg);
192
193 //! Parameter \relates jevois::Engine
194 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(usbserialdev, std::string, "Over-the-USB serial device name, or empty",
195 JEVOIS_USBSERIAL_DEFAULT, ParamCateg);
196
197 //! Parameter \relates jevois::Engine
198 JEVOIS_DECLARE_PARAMETER(camreg, bool, "Enable raw access to camera registers through setcamreg and getcamreg",
199 false, ParamCateg);
200
201 //! Parameter \relates jevois::Engine
202 JEVOIS_DECLARE_PARAMETER(imureg, bool, "Enable raw access to IMU registers through setimureg and getimureg",
203 false, ParamCateg);
204
205 //! Parameter \relates jevois::Engine
206 JEVOIS_DECLARE_PARAMETER(camturbo, bool, "Enable camera turbo mode by relaxing the need for DMA-coherent video "
207 "buffer memory. This can accelerate severalfolds access to the captured image data, but "
208 "it may also yield stripe artifacts with some modules, such as PassThrough. The stripes "
209 "are pieces of incorrect data in the cache. You should experiment with each particular "
210 "module. Turbo mode is not recommended for any production-grade application.",
211 false, ParamCateg);
212
213 //! Enum for Parameter \relates jevois::Engine
214 JEVOIS_DEFINE_ENUM_CLASS(SerPort, (None) (All) (Hard) (USB) );
215
216 //! Parameter \relates jevois::Engine
217 JEVOIS_DECLARE_PARAMETER(serlog, SerPort, "Show log and debug messages on selected serial port(s)",
218 SerPort::None, SerPort_Values, ParamCateg);
219
220 //! Parameter \relates jevois::Engine
221 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(videoerrors, bool, "Show any machine vision module errors (exceptions) "
222 "in the video stream. Only takes effect if streaming video to USB.",
223 true, ParamCateg);
224
225 //! Parameter \relates jevois::Engine
226 JEVOIS_DECLARE_PARAMETER(serout, SerPort, "Send module serial messages to selected serial port(s)",
227 SerPort::None, SerPort_Values, ParamCateg);
228
229 //! Enum for Parameter \relates jevois::Engine
230 JEVOIS_DEFINE_ENUM_CLASS(CPUmode, (PowerSave) (Conservative) (OnDemand) (Interactive) (Performance) );
231
232 //! Parameter \relates jevois::Engine
233 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumode, CPUmode, "CPU frequency modulation mode"
234#ifdef JEVOIS_PRO
235 " for A73 big cores"
236#endif
237 , CPUmode::Performance, CPUmode_Values, ParamCateg);
238
239#ifdef JEVOIS_PRO
240 //! Parameter \relates jevois::Engine
241 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumodel, CPUmode, "CPU frequency modulation mode for A53 little cores",
242 CPUmode::Performance, CPUmode_Values, ParamCateg);
243#endif
244
245 //! Parameter \relates jevois::Engine
246 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumax, unsigned int, "CPU maximum frequency in MHz"
247#ifdef JEVOIS_PRO
248 ". To enable overclock frequencies above 2208 MHz, you need to first edit "
249 "/boot/env.txt and change max_freq_a73, then reboot. Use with caution!"
250#endif
251#ifdef JEVOIS_A33
252 // keep this in sync with sunxi-cpufreq.c
253 , 1344, { 120, 240, 312, 408, 480, 504, 600, 648, 720, 816, 912, 1008,
254 1044, 1056, 1080, 1104, 1116, 1152, 1200, 1224, 1248, 1296, 1344 },
255#else
256 // keep this in sync with device tree
257 // A73 cores
258 , 2208, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
259 2100, 2208, 2304, 2400 },
260 // A53 cores
261 //1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
262 // 2100, 2208 },
263#endif
264 ParamCateg);
265#ifdef JEVOIS_PRO
266 //! Parameter \relates jevois::Engine
267 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumaxl, unsigned int, "CPU maximum frequency in MHz, for A53 little cores. "
268 "To enable overclock frequencies above 1800 MHz, you need to first edit "
269 "/boot/env.txt and change max_freq_a53, then reboot. Use with caution!",
270 // keep this in sync with device tree
271 1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
272 2100, 2208 },
273 ParamCateg);
274#endif
275
276 //! Parameter \relates jevois::Engine
277 JEVOIS_DECLARE_PARAMETER(multicam, bool, "Allow up to 3 JeVois cameras on one USB bus. Enabling this "
278 "reduces the amount of USB bandwidth used by each JeVois camera, from 3kb "
279 "per USB isochronous microframe to 1kb. All 3 JeVois cameras must have this "
280 "option enabled, and the JeVois linux kernel module should also have "
281 "been loaded with multicam on.",
282 false, ParamCateg);
283
284 //! Parameter \relates jevois::Engine
285 JEVOIS_DECLARE_PARAMETER(quietcmd, bool, "When true, do not issue a message 'OK' after every correct command "
286 "received at the command-line interface. Recommended for advanced users only.",
287 false, ParamCateg);
288
289 //! Parameter \relates jevois::Engine
290 JEVOIS_DECLARE_PARAMETER(python, bool, "When true, enable support for modules written in Python. Otherwise, "
291 "attempting to load a python module will throw an exception. Disabling python saves "
292 "a lot of memory and may be useful when using C++ modules that run large deep neural "
293 "networks.",
294 true, ParamCateg);
295
296 //! Parameter \relates jevois::Engine
297 JEVOIS_DECLARE_PARAMETER(serlimit, size_t, "Maximum number of serial messages that can be sent by a module "
298 "using sendSerial(), for each video frame, or 0 for no limit. Any message sent by "
299 "the module beyond the first serlimit ones will be dropped. This is useful to avoid "
300 "overloading the serial link, for example in case one is running a ArUco detector and "
301 "a large number of ArUco tags are present in the field of view of JeVois.",
302 0, ParamCateg);
303
304#ifdef JEVOIS_PRO
305 //! Parameter \relates jevois::Engine
306 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(gui, bool, "Use a graphical user interface instead of plain display "
307 "when true",
308 true, ParamCateg);
309 //! Parameter \relates jevois::Engine
310 JEVOIS_DECLARE_PARAMETER(conslock, bool, "Lock the console and capture the keyboard and mouse to avoid "
311 "interference, only effective on JeVois-Pro Platform, otherwise ignored. Set conslock "
312 "to false if you are experiencing hard crashes and want to run jevoispro-daemon in gdb.",
313 true, ParamCateg);
314
315 //! Parameter \relates jevois::Engine
316 JEVOIS_DECLARE_PARAMETER(watchdog, double, "Timeout in seconds after which we kill this process if the main loop "
317 "is stuck somehow, or 0.0 for no watchdog",
318 10.0, ParamCateg);
319
320 //! Parameter \relates jevois::Engine
321 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(demomode, float, "Show a demonstration of some available JeVois-Pro "
322 "machine vision modules, cycling to the next modules after a number "
323 "of seconds specified by this parameter (or 0.0 for no demo mode).",
324 0.0F, ParamCateg);
325#endif
326 }
327
328 //! JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB
329 /*! The Engine is orchestrating the execution of vision processing software. It is a Manager, i.e., it is the root of
330 a hierarchy of Component objects and it handles access to their Parameter settings and their construction, init(),
331 unInit(), and destruction. The component hierarchy consists of Engine at the root, then one Module which is
332 selected by the user at runtime, e.g., by selecting a given video format on video camera software running on a
333 host computer connected to the JeVois hardware. The Module may then contain an arbitrarily complex hierarchy of
334 Component objects with Parameter settings in them. Module derives from Component and thus may also have its own
335 Parameter settings.
336
337 Engine contains the following basic elements:
338
339 - A VideoInput, instantiated as either a Camera for live video streaming or a MovieInput for processing of
340 pre-recorded video files or sequences of images (useful during algorithm development, to test and optimize on
341 reproducible inputs);
342
343 - A VideoOutput, instantiated either as a USB Gadget driver when running on the JeVois hardware platform, or as a
344 VideoDisplay when running on a computer that has a graphics display, or as a MovieOutput to save output video
345 frames to disk, or as a VideoOutputNone if desired for benchmarking of vision algorithms while discounting any
346 work related to transmitting output frames.
347
348 - A DynamicLoader which handles loading the chosen vision processing Module at runtime depending on user
349 selections;
350
351 - Any number of UserInterface objects, instantiated as either a hardware Serial port (for the 4-pin JST 1.0mm
352 connector on the platform hardware), a serial-over-USB Serial port (visible on the host computer to which the
353 JeVois hardware is connected by USB), or an StdioInterface (used to accept commands and print results directly
354 in the terminal where the JeVois Engine was started, particularly useful when running on a generic computer as
355 opposed to the platform hardware). When running on platform hardware, usually two UserInterface objects are
356 created (one hardware Serial, one serial-over-USB Serial), while, when running on a generic computer, usually
357 only one UserInterface is created (of type StdioInterface to accept commands directly in the terminal in which
358 the jevois-daemon was started);
359
360 - The list of VideoMapping definitions imported from your videomappings.cfg file. These definitions specify which
361 video output modes are available over USB and their corresponding Camera settings and which Module to use, as
362 well as which modes are available that do not have any sreaming video output over USB (e.g., when connecting the
363 hardware platform to an Arduino only).
364
365 The main loop of Engine runs until the user decides to quit, and basically goes through the following steps:
366
367 - Create an InputFrame object which is an exception-safe wrapper around the next available Camera frame. The frame
368 may not have been captured yet. The InputFrame can be understood as a mechanism to gain access to that frame in
369 the future, when it has become available (i.e., has been captured by the camera). This is very similar to the
370 std::future framework of C++11.
371
372 - When the current VideoMapping specifies that we will be streaming video frames out over USB, also create an
373 OutputFrame object which is an exception-safe wrapper around the next available Gadget frame. This is also just
374 a mechanism for gaining access to the next blank video buffer that is available from the USB driver and that we
375 should fill with interesting pixel data before sending it over USB to a host computer.
376
377 - Call the currently-loaded Module's process() function, either as process(InputFrame, OutputFrame) when the
378 current VideoMapping specifies that some video output is to be sent over USB, or as process(InputFrame) when the
379 current VideoMapping specifies no video output. Any exception thrown by the Module's process() function will be
380 caught, reported, and ignored. The process() function would typically request the next available camera image
381 through the InputFrame wrapper (this request may block until the frame has been captured by the camera sensor
382 hardware), process that image, request the next available output image through the OutputFrame wrapper (when
383 VideoMapping specifies that there is USB video output), and paint some results into that output image, which
384 will then be sent to the host coputer over USB, for display by some webcam program or for further processing by
385 some custom vision software running on that computer. In addition, the currently loaded Module may issue
386 messages over the UserInterface ports (e.g., indicating the location at which an object was found, to let an
387 Arduino know about it).
388
389 - Read any new commands issued by users over the UserInterface ports and execute the appropriate commands.
390
391 - Handle user requests to change VideoMapping, when they select a different video mode in their webcam software
392 running on the host computer connected to the JeVois hardware. Such requests may trigger unloading of the
393 current Module and loading a new one, and changing camera pixel format, image size, etc. These changes are
394 guaranteed to occur when the Module's process() function is not running, i.e., Module programmers do not have to
395 worry about possible changes in image dimensions or pixel formats during execution of their process() function.
396
397 - Pass any user requests received over USB or UserInterface to adjust camera parameters to the actual Camera
398 hardware driver (e.g., when users change contrast in their webcam program, that request is sent to the Engine
399 over USB, and the Engine then forwards it to the Camera hardware driver).
400
401 \ingroup core */
402 class Engine : public Manager,
403 public Parameter<engine::cameradev, engine::camerasens, engine::cameralens, engine::cameranbuf,
404 engine::gadgetdev, engine::gadgetnbuf, engine::imudev, engine::videomapping,
405 engine::serialdev, engine::usbserialdev, engine::camreg, engine::imureg,
406 engine::camturbo, engine::serlog, engine::videoerrors, engine::serout,
407 engine::cpumode, engine::cpumax, engine::multicam, engine::quietcmd,
408 engine::python, engine::serlimit
409#ifdef JEVOIS_PRO
410 , engine::serialmonitors, engine::gui, engine::conslock, engine::cpumaxl,
411 engine::cpumodel, engine::watchdog, engine::demomode
412#endif
413 >
414 {
415 public:
416 //! Constructor
417 Engine(std::string const & instance);
418
419 //! Constructor with command-line parsing
420 Engine(int argc, char const* argv[], std::string const & instance);
421
422 //! Destructor
423 ~Engine();
424
425 //! Re-load video mappings from videomappings.cfg
426 /*! Mappings are automatically loaded on startup so this should only be used if the file has been modified and the
427 mappings need to be refreshed. Note that this will not refresh the available resolutions for USB output, which
428 requires a full reboot to re-initialize the kernel Gadget module. Also beware of possible state inconsistency
429 (e.g., if external code is holding a reference previously returned by findVideoMapping(). So, use with
430 caution. Basically, only GUIhelper should use this. */
431 void reloadVideoMappings();
432
433 //! Find the VideoMapping that has the given output specs, or throw if not found
434 VideoMapping const & findVideoMapping(unsigned int oformat, unsigned int owidth, unsigned int oheight,
435 float oframespersec) const;
436
437 //! Get the current video mapping
438 /*! Note that the current mapping may not have an entry in our list of mappings obtained from videomappings.cfg,
439 if the current one was set on the fly by the setmapping2 CLI command. */
440 VideoMapping const & getCurrentVideoMapping() const;
441
442 //! Return the number of video mappings
443 size_t numVideoMappings() const;
444
445 //! Allow access to our video mappings which are parsed from file at construction
446 VideoMapping const & getVideoMapping(size_t idx) const;
447
448 //! Get the video mapping index for a given UVC iformat, iframe and interval
449 size_t getVideoMappingIdx(unsigned int iformat, unsigned int iframe, unsigned int interval) const;
450
451 //! Allow access to the default video mapping
452 VideoMapping const & getDefaultVideoMapping() const;
453
454 //! Allow access to the default video mapping index
455 size_t getDefaultVideoMappingIdx() const;
456
457 //! Run a function on every video mapping
458 /*! The first mapping your function will be called on is for mapping with index 0, and so on until index
459 numVideoMappings()-1. If your function throws, we report the exception and then ignore it, then we move on to
460 the next mapping. */
461 void foreachVideoMapping(std::function<void(VideoMapping const & m)> && func);
462
463 //! Use this to request a format change from within process()
464 /*! This should only be used on JeVois-Pro in GUI mode. The engine is locked up hence and setFormat() cannot be
465 called from within a Module's process function, to avoid possible disasters of changing format while we
466 process. Modules or the GUI can use requestSetFormat() to request a format change in between two calls to
467 process(). Note special values: -1 to just reload the current format (e.g., after editing code), -2 does
468 nothing. */
469 void requestSetFormat(int idx);
470
471 //! Terminate the program
472 void quit();
473
474 //! Request a reboot
475 /*! On JeVois-A33 Platform, trigger a hard reset. On JeVois-Pro Platform or JeVois-Host, just terminate the
476 program. */
477 void reboot();
478
479 //! Callback for when the user selects a new output video format
480 /*! Here, we stop streaming, nuke any current processing module, set the camera format, set the gadget output
481 format, load the new processing module, and start streaming again. The given VideoMapping will typically be
482 obtained using findVideoMapping() from output specs received over the USB link. */
483 void setFormat(size_t idx);
484
485 //! Start streaming on video from camera, processing, and USB
486 void streamOn();
487
488 //! Stop streaming on video from camera, processing, and USB
489 void streamOff();
490
491 //! Main loop: grab, process, send over USB. Should be called by main application thread
492 int mainLoop();
493
494 //! Send a string to all serial ports
495 /*! \note When islog is true, this is assumes to be a log message, and it will be sent to the port(s) specified by
496 parameter serlog. Otherwise, the message will be sent to the ports specified by parameter serout. Note how the
497 number of messages that can be sent for each video frame may be limited by parameter \p serlimit; only up to
498 \p serlimit messages will be sent for a given video frame. This is useful to avoid overloading the serial
499 link, for example in cases one is running a ArUco detector and a large number of ArUco tags are present in the
500 field of view of JeVois. */
501 void sendSerial(std::string const & str, bool islog = false);
502
503 //! Get a pointer to our current module (may be null)
504 std::shared_ptr<Module> module() const;
505
506 //! Get a pointer to our IMU (may be null)
507 std::shared_ptr<IMU> imu() const;
508
509 //! Get a pointer to our Camera (may be null, especially if not using a camera but, eg, movie input)
510 std::shared_ptr<Camera> camera() const;
511
512#ifdef JEVOIS_PRO
513 //! Draw all camera controls into our GUI
514 void drawCameraGUI();
515#endif
516
517 //! Helper to load an OpenCV camera matrix and distortion coeffs for the current running module
518 /*! If do_throw is false, just report an error and provide identity defaults if calibration mot found. This would
519 typically be called in preInit() or postInit() of any module that will need the calibration parameters. Note:
520 for thread safety, engine should be locked; calling this inside Module::process() is safe. */
521 CameraCalibration loadCameraCalibration(std::string const & stem = "calibration", bool do_throw = false);
522
523 //! Helper to save an OpenCV camera matrix and distortion coeffs for the current running module
524 /*! Note: for thread safety, engine should be locked; calling this inside Module::process() is safe. */
525 void saveCameraCalibration(CameraCalibration const & calib, std::string const & stem = "calibration");
526
527 //! Register a component as linked to some python code, used by dynamic params created in python
528 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
529 void registerPythonComponent(Component * comp, void * pyinst);
530
531 //! Unregister a component as linked to some python code, used by dynamic params created in python
532 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
534
535 //! Get the component registered with a given python instance
536 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
537 Component * getPythonComponent(void * pyinst) const;
538
539 // Report an error to console and JeVois-Pro GUI
540 /*! Try to minimize the use of this function, and normally use LERROR() or LFATAL() instead. Currently the only
541 use is in jevois::dnn::Pipeline, to report parameters set in the zoo file but not used by the pipeline, as
542 issuing an LFATAL() for that may be too strict, but issuing an LERROR() may go un-noticed since the pipeline
543 is still running just fine. */
544 void reportError(std::string const & err);
545
546 //! Clear all errors currently displayed in the JeVois-Pro GUI
547 /*! In the JevoisPro GUI, errors reported via reportError() remain displayed for a few seconds, but sometimes we
548 want to clear them right away, e.g., after DNN pipeline threw, if the user selects another one, we want the
549 previous error to disappear immediately since it is not applicable anymore. When the JeVois-Pro GUI is not
550 used, this has no effect. */
551 void clearErrors();
552
553#ifdef JEVOIS_PRO
554 //! When in demo mode, switch to next demo
555 void nextDemo();
556
557 //! When in demo mode, abort demo mode
558 void abortDemo();
559#endif
560
561 protected:
562 //! Run a script from file
563 /*! The filename should be absolute. The file should have any of the commands supported by Engine, one per
564 line. Filename should be relative to the current module's path. */
565 void runScriptFromFile(std::string const & filename, std::shared_ptr<UserInterface> ser,
566 bool throw_no_file);
567
568 //! Parameter callback
569 void onParamChange(engine::serialdev const & param, std::string const & newval) override;
570
571 //! Parameter callback
572 void onParamChange(engine::usbserialdev const & param, std::string const & newval) override;
573
574 //! Parameter callback
575 void onParamChange(engine::cpumode const & param, engine::CPUmode const & newval) override;
576
577 //! Parameter callback
578 void onParamChange(engine::cpumax const & param, unsigned int const & newval) override;
579
580 //! Parameter callback
581 void onParamChange(engine::videoerrors const & param, bool const & newval) override;
582
583#ifdef JEVOIS_PRO
584 //! Parameter callback
585 void onParamChange(engine::gui const & param, bool const & newval) override;
586
587 //! Parameter callback
588 void onParamChange(engine::cpumaxl const & param, unsigned int const & newval) override;
589
590 //! Parameter callback
591 void onParamChange(engine::cpumodel const & param, engine::CPUmode const & newval) override;
592
593 //! Parameter callback
594 void onParamChange(engine::demomode const & param, float const & newval) override;
595#endif
596
597 size_t itsDefaultMappingIdx; //!< Index of default mapping
598 std::vector<VideoMapping> itsMappings; //!< All our mappings from videomappings.cfg
599 VideoMapping itsCurrentMapping; //!< Current mapping, may not match any in itsMappings if setmapping2 used
600
601 std::shared_ptr<VideoInput> itsCamera; //!< Our camera
602 std::shared_ptr<IMU> itsIMU; //! Our IMU
603 std::shared_ptr<VideoOutput> itsGadget; //!< Our gadget
604
605 std::unique_ptr<DynamicLoader> itsLoader; //!< Our module loader
606 std::shared_ptr<Module> itsModule; //!< Our current module
607
608 std::atomic<bool> itsRunning; //!< True when we are running
609 std::atomic<bool> itsStreaming; //!< True when we are streaming video
610 std::atomic<bool> itsStopMainLoop; //!< Flag used to stop the main loop
611
612 mutable std::timed_mutex itsMtx; //!< Mutex to protect our internals
613
614 void preInit() override; //!< Override of Manager::preInit()
615 void postInit() override; //!< Override of Manager::postInit()
616
617 //! Parse a user command received over serial port
618 /*! Throw upon receiving an incorrect command (eg, bad parameter value), return true if success, return false if
619 command was not recognized and should be tried by Module. pfx is an optional prefix which will be added to all
620 produced messages or errors. */
621 bool parseCommand(std::string const & str, std::shared_ptr<UserInterface> s, std::string const & pfx = "");
622
623 private:
624 std::list<std::shared_ptr<UserInterface> > itsSerials;
625
626 void setFormatInternal(size_t idx); // itsMtx should be locked by caller
627 void setFormatInternal(jevois::VideoMapping const & m, bool reload = false); // itsMtx should be locked by caller
628
629 // Loop over all available camera controls and run a function on each:
630 void foreachCamCtrl(std::function<void(struct v4l2_queryctrl & qc, std::set<int> & doneids)> && func);
631
632 // Return help string for a camera control or throw
633 std::string camCtrlHelp(struct v4l2_queryctrl & qc, std::set<int> & doneids);
634
635 // Return machine-oriented string for a camera control or throw
636 std::string camCtrlInfo(struct v4l2_queryctrl & qc, std::set<int> & doneids);
637
638 // Send info about built-in engine commands
639 void cmdInfo(std::shared_ptr<UserInterface> s, bool showAll, std::string const & pfx = "");
640
641 // Send info about module commands
642 void modCmdInfo(std::shared_ptr<UserInterface> s, std::string const & pfx = "");
643
644 // Get short name from V4L2 ID, long name is a backup in case we don't find the control in our list
645 std::string camctrlname(unsigned int id, char const * longname) const;
646
647 // Get V4L2 ID from short name
648 unsigned int camctrlid(std::string const & shortname);
649
650 // Report an error to console, video frame, or GUI
651 /*! Call this from within catch. Note, in GUI mode, this calls endFrame() so it should not be used except for
652 exceptions that will not be ignored. */
653 void reportErrorInternal(std::string const & err = "");
654
655 bool itsShellMode; // When true, pass any CLI command to the Linux shell
656 bool itsTurbo;
657 bool itsManualStreamon; // allow manual streamon when outputing video to None or file
658 std::atomic<bool> itsVideoErrors; // fast cached value for engine::videoerrors
659 jevois::RawImage itsVideoErrorImage;
660 std::string itsModuleConstructionError; // Non-empty error message if module constructor threw
661
662#ifdef JEVOIS_PLATFORM_A33
663 // Things related to mass storage gadget to export our /jevois partition as a virtual USB flash drive:
664 void checkMassStorage(); // thread to check mass storage gadget status
665 std::future<void> itsCheckMassStorageFut;
666 std::atomic<bool> itsCheckingMassStorage;
667 std::atomic<bool> itsMassStorageMode;
668 void startMassStorageMode();
669 void stopMassStorageMode();
670#endif
671
672 std::atomic<size_t> itsNumSerialSent; // Number of serial messages sent this frame; see serlimit
673 std::atomic<int> itsRequestedFormat; // Set by requestSetFormat(), could be -1 to reload, otherwise -2
674
675#ifdef JEVOIS_PRO
676 std::shared_ptr<GUIhelper> itsGUIhelper;
677
678 // Draw ImGui widgets for all camera controls
679 void camCtrlGUI(struct v4l2_queryctrl & qc, std::set<int> & doneids);
680
681 std::shared_ptr<jevois::Watchdog> itsWatchdog;
682
683 bool itsDemoReset = true; // Restart the demo
684 void runDemoStep(); // run one step of the demo mode
685 struct DemoData
686 {
687 int mapping_idx;
688 std::string title;
689 std::string msg;
690 std::vector<std::pair<std::string /* param name */, std::string /* param val */>> params;
691 };
692 std::vector<DemoData> itsDemoData;
693 bool itsNextDemoRequested = false;
694#endif
695
696 // Python code registry, used to assign dynamic parameters created in python code to the correct owning component.
697 // This looks thread-unsafe but should be ok as long as objects inherit first from Component and then from
698 // PythonWrapper.
699 std::map<void *, Component *> itsPythonRegistry;
700 mutable std::mutex itsPyRegMtx;
701 };
702} // namespace jevois
703
#define JEVOIS_A33
Target hardware selection:
Definition Config.H:36
#define JEVOIS_CAMERASENS_DEFAULT
Default camera sensor.
Definition Engine.H:80
#define JEVOIS_CAMERA_DEFAULT
On platform hardware, device for the camera sensor.
Definition Engine.H:67
#define JEVOIS_GADGET_DEFAULT
On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host c...
Definition Engine.H:70
#define JEVOIS_SERIAL_DEFAULT
On platform hardware, device for the 4-pin hardware serial port.
Definition Engine.H:73
#define JEVOIS_USBSERIAL_DEFAULT
On platform hardware, device for serial-over-USB port.
Definition Engine.H:76
#define JEVOIS_IMUSPI_DEFAULT
Default IMU spi device.
Definition Engine.H:83
Helper class for camera calibration, which allows some modules to compute 3D locations of objects.
A component of a model hierarchy.
Definition Component.H:182
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
Definition Engine.H:414
Component * getPythonComponent(void *pyinst) const
Get the component registered with a given python instance.
Definition Engine.C:3015
JEVOIS_DECLARE_PARAMETER(cameralens, CameraLens, "Camera lens. Users should usually not set this parameter " "using the global JeVois params.cfg config file.", CameraLens::standard, CameraLens_Values, ParamCateg)
Parameter.
void requestSetFormat(int idx)
Use this to request a format change from within process()
Definition Engine.C:932
void streamOn()
Start streaming on video from camera, processing, and USB.
Definition Engine.C:900
void drawCameraGUI()
Draw all camera controls into our GUI.
Definition Engine.C:2859
void nextDemo()
When in demo mode, switch to next demo.
Definition Engine.C:600
void reboot()
Request a reboot.
Definition Engine.C:1848
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(usbserialdev, std::string, "Over-the-USB serial device name, or empty", JEVOIS_USBSERIAL_DEFAULT, ParamCateg)
Parameter.
void onParamChange(engine::cpumaxl const &param, unsigned int const &newval) override
Parameter callback.
std::atomic< bool > itsStopMainLoop
Flag used to stop the main loop.
Definition Engine.H:610
JEVOIS_DECLARE_PARAMETER(quietcmd, bool, "When true, do not issue a message 'OK' after every correct command " "received at the command-line interface. Recommended for advanced users only.", false, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(videoerrors, bool, "Show any machine vision module errors (exceptions) " "in the video stream. Only takes effect if streaming video to USB.", true, ParamCateg)
Parameter.
void preInit() override
Override of Manager::preInit()
Definition Engine.C:617
std::shared_ptr< Module > itsModule
Our current module.
Definition Engine.H:606
JEVOIS_DECLARE_PARAMETER(python, bool, "When true, enable support for modules written in Python. Otherwise, " "attempting to load a python module will throw an exception. Disabling python saves " "a lot of memory and may be useful when using C++ modules that run large deep neural " "networks.", true, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(watchdog, double, "Timeout in seconds after which we kill this process if the main loop " "is stuck somehow, or 0.0 for no watchdog", 10.0, ParamCateg)
Parameter.
std::atomic< bool > itsStreaming
True when we are streaming video.
Definition Engine.H:609
void onParamChange(engine::serialdev const &param, std::string const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(imureg, bool, "Enable raw access to IMU registers through setimureg and getimureg", false, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serout, SerPort, "Send module serial messages to selected serial port(s)", SerPort::None, SerPort_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(camturbo, bool, "Enable camera turbo mode by relaxing the need for DMA-coherent video " "buffer memory. This can accelerate severalfolds access to the captured image data, but " "it may also yield stripe artifacts with some modules, such as PassThrough. The stripes " "are pieces of incorrect data in the cache. You should experiment with each particular " "module. Turbo mode is not recommended for any production-grade application.", false, ParamCateg)
Parameter.
void saveCameraCalibration(CameraCalibration const &calib, std::string const &stem="calibration")
Helper to save an OpenCV camera matrix and distortion coeffs for the current running module.
Definition Engine.C:1508
std::atomic< bool > itsRunning
True when we are running.
Definition Engine.H:608
size_t numVideoMappings() const
Return the number of video mappings.
Definition Engine.C:1526
std::shared_ptr< Module > module() const
Get a pointer to our current module (may be null)
Definition Engine.C:1458
void onParamChange(engine::demomode const &param, float const &newval) override
Parameter callback.
std::shared_ptr< IMU > itsIMU
Definition Engine.H:602
void onParamChange(engine::cpumax const &param, unsigned int const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(conslock, bool, "Lock the console and capture the keyboard and mouse to avoid " "interference, only effective on JeVois-Pro Platform, otherwise ignored. Set conslock " "to false if you are experiencing hard crashes and want to run jevoispro-daemon in gdb.", true, ParamCateg)
Parameter.
void abortDemo()
When in demo mode, abort demo mode.
Definition Engine.C:604
size_t getDefaultVideoMappingIdx() const
Allow access to the default video mapping index.
Definition Engine.C:1574
JEVOIS_DECLARE_PARAMETER(videomapping, int, "Index of Video Mapping to use, or -1 to use the default mapping. " "Note that this parameter is only available when parsing command-line arguments. " "At runtime, the setmapping command should be used instead.", -1, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serlog, SerPort, "Show log and debug messages on selected serial port(s)", SerPort::None, SerPort_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(multicam, bool, "Allow up to 3 JeVois cameras on one USB bus. Enabling this " "reduces the amount of USB bandwidth used by each JeVois camera, from 3kb " "per USB isochronous microframe to 1kb. All 3 JeVois cameras must have this " "option enabled, and the JeVois linux kernel module should also have " "been loaded with multicam on.", false, ParamCateg)
Parameter.
JEVOIS_DEFINE_ENUM_CLASS(SerPort,(None)(All)(Hard)(USB))
Enum for Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumaxl, unsigned int, "CPU maximum frequency in MHz, for A53 little cores. " "To enable overclock frequencies above 1800 MHz, you need to first edit " "/boot/env.txt and change max_freq_a53, then reboot. Use with caution!", 1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016, 2100, 2208 }, ParamCateg)
Parameter.
void setFormat(size_t idx)
Callback for when the user selects a new output video format.
Definition Engine.C:939
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(demomode, float, "Show a demonstration of some available JeVois-Pro " "machine vision modules, cycling to the next modules after a number " "of seconds specified by this parameter (or 0.0 for no demo mode).", 0.0F, ParamCateg)
Parameter.
void onParamChange(engine::usbserialdev const &param, std::string const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(serlimit, size_t, "Maximum number of serial messages that can be sent by a module " "using sendSerial(), for each video frame, or 0 for no limit. Any message sent by " "the module beyond the first serlimit ones will be dropped. This is useful to avoid " "overloading the serial link, for example in case one is running a ArUco detector and " "a large number of ArUco tags are present in the field of view of JeVois.", 0, ParamCateg)
Parameter.
void onParamChange(engine::gui const &param, bool const &newval) override
Parameter callback.
void unRegisterPythonComponent(Component *comp)
Unregister a component as linked to some python code, used by dynamic params created in python.
Definition Engine.C:3006
void onParamChange(engine::cpumodel const &param, engine::CPUmode const &newval) override
Parameter callback.
void sendSerial(std::string const &str, bool islog=false)
Send a string to all serial ports.
Definition Engine.C:1346
void streamOff()
Stop streaming on video from camera, processing, and USB.
Definition Engine.C:911
void runScriptFromFile(std::string const &filename, std::shared_ptr< UserInterface > ser, bool throw_no_file)
Run a script from file.
Definition Engine.C:2781
JEVOIS_DECLARE_PARAMETER(cameranbuf, unsigned int, "Number of video input (camera) buffers, or 0 for automatic.", 0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumax, unsigned int, "CPU maximum frequency in MHz" ". To enable overclock frequencies above 2208 MHz, you need to first edit " "/boot/env.txt and change max_freq_a73, then reboot. Use with caution!", 2208, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016, 2100, 2208, 2304, 2400 }, ParamCateg)
Parameter.
size_t itsDefaultMappingIdx
Index of default mapping.
Definition Engine.H:597
JEVOIS_DEFINE_ENUM_CLASS(CPUmode,(PowerSave)(Conservative)(OnDemand)(Interactive)(Performance))
Enum for Parameter.
void quit()
Terminate the program.
Definition Engine.C:1869
bool parseCommand(std::string const &str, std::shared_ptr< UserInterface > s, std::string const &pfx="")
Parse a user command received over serial port.
Definition Engine.C:1971
void onParamChange(engine::videoerrors const &param, bool const &newval) override
Parameter callback.
int mainLoop()
Main loop: grab, process, send over USB. Should be called by main application thread.
Definition Engine.C:1095
~Engine()
Destructor.
Definition Engine.C:830
JEVOIS_DECLARE_PARAMETER(gadgetdev, std::string, "Gadget device name. This is used on platform hardware only. " "On host hardware, a display window will be used unless gadgetdev is None (useful " "for benchmarking) or is a file stem for a movie file that does not start with /dev/ " "(and which should contain a printf-style directive for a single int argument, " "the movie number).", JEVOIS_GADGET_DEFAULT, ParamCateg)
Parameter.
VideoMapping const & getVideoMapping(size_t idx) const
Allow access to our video mappings which are parsed from file at construction.
Definition Engine.C:1530
size_t getVideoMappingIdx(unsigned int iformat, unsigned int iframe, unsigned int interval) const
Get the video mapping index for a given UVC iformat, iframe and interval.
Definition Engine.C:1539
JEVOIS_DECLARE_PARAMETER(gadgetnbuf, unsigned int, "Number of video output (USB video) buffers, or 0 for auto", 0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serialmonitors, bool, "If true, serial port monitors will be enabled " "in the GUI, which can be used to peek at serial communications not " "directed to the console. Can be turned off at start time (e.g., in the " "global JeVois params.cfg) as there is some small CPU cost to it.", true, ParamCateg)
Parameter.
VideoMapping const & getCurrentVideoMapping() const
Get the current video mapping.
Definition Engine.C:1522
void registerPythonComponent(Component *comp, void *pyinst)
Register a component as linked to some python code, used by dynamic params created in python.
Definition Engine.C:2996
JEVOIS_DECLARE_PARAMETER(camreg, bool, "Enable raw access to camera registers through setcamreg and getcamreg", false, ParamCateg)
Parameter.
CameraCalibration loadCameraCalibration(std::string const &stem="calibration", bool do_throw=false)
Helper to load an OpenCV camera matrix and distortion coeffs for the current running module.
Definition Engine.C:1470
VideoMapping const & findVideoMapping(unsigned int oformat, unsigned int owidth, unsigned int oheight, float oframespersec) const
Find the VideoMapping that has the given output specs, or throw if not found.
Definition Engine.C:1586
void onParamChange(engine::cpumode const &param, engine::CPUmode const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(camerasens, CameraSensor, "Camera sensor. Users would usually not set this parameter " "manually, it is set through boot-time configuration.", JEVOIS_CAMERASENS_DEFAULT, CameraSensor_Values, ParamCateg)
Parameter.
void reloadVideoMappings()
Re-load video mappings from videomappings.cfg.
Definition Engine.C:628
void postInit() override
Override of Manager::postInit()
Definition Engine.C:641
std::shared_ptr< Camera > camera() const
Get a pointer to our Camera (may be null, especially if not using a camera but, eg,...
Definition Engine.C:1466
VideoMapping const & getDefaultVideoMapping() const
Allow access to the default video mapping.
Definition Engine.C:1570
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumode, CPUmode, "CPU frequency modulation mode" " for A73 big cores", CPUmode::Performance, CPUmode_Values, ParamCateg)
Parameter.
std::shared_ptr< VideoInput > itsCamera
Our camera.
Definition Engine.H:601
JEVOIS_DECLARE_PARAMETER(cameradev, std::string, "Camera device name (if starting with /dev/v...), or movie " "file name (e.g., movie.mpg) or image sequence (e.g., im%02d.jpg, to read frames " "im00.jpg, im01.jpg, etc).", JEVOIS_CAMERA_DEFAULT, ParamCateg)
Parameter.
std::shared_ptr< VideoOutput > itsGadget
Our IMU.
Definition Engine.H:603
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumodel, CPUmode, "CPU frequency modulation mode for A53 little cores", CPUmode::Performance, CPUmode_Values, ParamCateg)
Parameter.
std::timed_mutex itsMtx
Mutex to protect our internals.
Definition Engine.H:612
std::vector< VideoMapping > itsMappings
All our mappings from videomappings.cfg.
Definition Engine.H:598
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(serialdev, std::string, "Hardware (4-pin connector) serial device name, " "or 'stdio' to use the console, or empty for no hardware serial port", JEVOIS_SERIAL_DEFAULT, ParamCateg)
Parameter.
void clearErrors()
Clear all errors currently displayed in the JeVois-Pro GUI.
Definition Engine.C:1400
void foreachVideoMapping(std::function< void(VideoMapping const &m)> &&func)
Run a function on every video mapping.
Definition Engine.C:1578
void reportError(std::string const &err)
Definition Engine.C:1391
std::unique_ptr< DynamicLoader > itsLoader
Our module loader.
Definition Engine.H:605
VideoMapping itsCurrentMapping
Current mapping, may not match any in itsMappings if setmapping2 used.
Definition Engine.H:599
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(gui, bool, "Use a graphical user interface instead of plain display " "when true", true, ParamCateg)
Parameter.
Manager of a hierarchy of Component objects.
Definition Manager.H:74
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition RawImage.H:111
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2
Simple struct to hold video mapping definitions for the processing Engine.