29#include <opencv2/core/core.hpp>
35#include <glm/gtc/matrix_transform.hpp>
110 Module(std::string
const & instance);
164 virtual void sendSerial(std::string
const & str);
181 virtual void parseSerial(std::string
const & str, std::shared_ptr<UserInterface> s);
198 "http://jevois.org/doc/UserSerialStyle.html",
199 SerStyle::Terse, SerStyle_Values, ParamCateg);
203 "defined in http://jevois.org/doc/UserSerialStyle.html",
211 "time, frame+time, or frame+date+time. See details in "
212 "http://jevois.org/doc/UserSerialStyle.html",
213 SerStamp::None, SerStamp_Values, ParamCateg);
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);
233 public Parameter<modul::serprec, modul::serstyle, modul::serstamp, modul::sermark>
247 void sendSerialImg1Dx(
unsigned int camw,
float x,
float size = 0.0F, std::string
const &
id =
"",
248 std::string
const & extra =
"");
253 void sendSerialStd1Dx(
float x,
float size = 0.0F, std::string
const &
id =
"", std::string
const & extra =
"");
258 void sendSerialImg1Dy(
unsigned int camh,
float y,
float size = 0.0F, std::string
const &
id =
"",
259 std::string
const & extra =
"");
264 void sendSerialStd1Dy(
float y,
float size = 0.0F, std::string
const &
id =
"", std::string
const & extra =
"");
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 =
"");
280 std::string
const &
id =
"", std::string
const & extra =
"");
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 =
"");
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 =
"");
307 void sendSerialStd3D(std::vector<cv::Point3f> points, std::string
const &
id =
"",
308 std::string
const & extra =
"");
319 std::vector<ObjReco>
const & res);
358#define JEVOIS_REGISTER_MODULE(MODULENAME) \
359 extern "C" std::shared_ptr<jevois::Module> MODULENAME##_create(std::string const & instanceid) \
360 { return std::shared_ptr<jevois::Module>(new MODULENAME(instanceid)); } \
361 extern "C" int MODULENAME##_version_major() { return JEVOIS_VERSION_MAJOR; } \
362 extern "C" int MODULENAME##_version_minor() { return JEVOIS_VERSION_MINOR; } \
382#define JEVOIS_DISABLED_MODULE(MODULENAME) \
383 class MODULENAME : public jevois::Module { \
385 MODULENAME(std::string const & instancename) : jevois::Module(instancename) \
386 { throw std::runtime_error("This module is disabled on your hardware configuration"); } \
388 extern "C" std::shared_ptr<jevois::Module> MODULENAME##_create(std::string const & instanceid) \
389 { return std::shared_ptr<jevois::Module>(new MODULENAME(instanceid)); } \
390 extern "C" int MODULENAME##_version_major() { return JEVOIS_VERSION_MAJOR; } \
391 extern "C" int MODULENAME##_version_minor() { return JEVOIS_VERSION_MINOR; } \
A component of a model hierarchy.
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
Helper class to assist modules in creating graphical and GUI elements.
Virtual base class for a vision processing module.
virtual void sendSerial(std::string const &str)
Send a string over the 'serout' serial port.
virtual void supportedCommands(std::ostream &os)
Human-readable description of this Module's supported custom commands.
virtual void parseSerial(std::string const &str, std::shared_ptr< UserInterface > s)
Receive a string from a serial port which contains a user command.
virtual ~Module()
Virtual destructor for safe inheritance.
virtual void process(InputFrame &&inframe, OutputFrame &&outframe)
Processing function, version that receives a frame from camera and sends a frame out over USB.
Exception-safe wrapper around a raw image to be sent over USB.
Base class for a module that supports standardized serial messages.
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.
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.
virtual ~StdModule()
Virtual destructor for safe inheritance.
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.
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.
void sendSerialObjReco(std::vector< ObjReco > const &res)
Send a standardized object recognition message.
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.
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.
void sendSerialMarkStop()
Send a message MARK STOP to indicate the end of processing.
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.
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.
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.
void sendSerialMarkStart()
Send a message MARK START to indicate the beginning of processing.
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.
Main namespace for all JeVois classes and functions.
A trivial struct to store object detection results, for oriented bounding boxes (OBB)
A trivial struct to store object detection results, for standard (straight up) bounding boxes.
A category to which multiple ParameterDef definitions can belong.