JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
18 #include <boost/python.hpp>
41 #define PY_ARRAY_UNIQUE_SYMBOL pbcvt_ARRAY_API
46 #define JEVOIS_PYTHON_FUNC(funcname) \
47 boost::python::def(#funcname, jevois::funcname)
50 #define JEVOIS_PYTHON_RAWIMAGE_FUNC(funcname) \
51 boost::python::def(#funcname, jevois::rawimage::funcname)
54 #define JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(val) value(#val, jevois::rawimage::val)
57 #define JEVOIS_PYTHON_ENUM_VAL(val) value(#val, jevois::python::val)
60 #define JEVOIS_PYTHON_CONSTANT(cst) boost::python::scope().attr(#cst) = cst;
63 #define JEVOIS_PYTHON_DNN_FUNC(funcname) \
64 boost::python::def(#funcname, jevois::dnn::funcname)
81 Py_SetProgramName(Py_DecodeLocale(
"",
nullptr));
110 return PyObject_HasAttrString(
o.ptr(), name);
118 void pythonSendSerial(std::string
const & str)
119 { jevois::python::engine()->sendSerial(str); }
121 size_t pythonFrameNum()
122 {
return jevois::frameNum(); }
124 void pythonWriteCamRegister(
unsigned short reg,
unsigned short val)
126 auto cam = jevois::python::engine()->camera();
127 if (!cam)
LFATAL(
"Not using a Camera for video input");
128 cam->writeRegister(reg, val);
131 unsigned short pythonReadCamRegister(
unsigned short reg)
133 auto cam = jevois::python::engine()->camera();
134 if (!cam)
LFATAL(
"Not using a Camera for video input");
135 return cam->readRegister(reg);
138 void pythonWriteIMUregister(
unsigned short reg,
unsigned short val)
140 auto imu = jevois::python::engine()->imu();
141 if (!imu)
LFATAL(
"No IMU driver loaded");
142 imu->writeRegister(reg, val);
145 unsigned short pythonReadIMUregister(
unsigned short reg)
147 auto imu = jevois::python::engine()->imu();
148 if (!imu)
LFATAL(
"No IMU driver loaded");
149 return imu->readRegister(reg);
152 void pythonWriteDMPregister(
unsigned short reg,
unsigned short val)
154 auto imu = jevois::python::engine()->imu();
155 if (!imu)
LFATAL(
"No IMU driver loaded");
156 imu->writeDMPregister(reg, val);
159 unsigned short pythonReadDMPregister(
unsigned short reg)
161 auto imu = jevois::python::engine()->imu();
162 if (!imu)
LFATAL(
"No IMU driver loaded");
163 return imu->readDMPregister(reg);
166 #ifdef JEVOIS_LDEBUG_ENABLE
167 void pythonLDEBUG(std::string
const & logmsg) {
LDEBUG(logmsg); }
169 void pythonLDEBUG(std::string
const & JEVOIS_UNUSED_PARAM(logmsg)) { }
171 void pythonLINFO(std::string
const & logmsg) {
LINFO(logmsg); }
172 void pythonLERROR(std::string
const & logmsg) {
LERROR(logmsg); }
173 void pythonLFATAL(std::string
const & logmsg) {
LFATAL(logmsg); }
178 std::string pythonGetParamStringUnique(boost::python::object & pyinst, std::string
const & descriptor)
180 jevois::Component * comp = jevois::python::engine()->getPythonComponent(pyinst.ptr()->ob_type);
184 void pythonSetParamStringUnique(boost::python::object & pyinst, std::string
const & descriptor,
185 std::string
const & val)
187 jevois::Component * comp = jevois::python::engine()->getPythonComponent(pyinst.ptr()->ob_type);
208 BOOST_PYTHON_MODULE(libjevoispro)
210 BOOST_PYTHON_MODULE(libjevois)
214 boost::python::to_python_converter<cv::Mat, pbcvt::matToNDArrayBoostConverter>();
220 boost::python::scope().attr(
"pro") =
true;
222 boost::python::scope().attr(
"pro") =
false;
226 #ifdef JEVOIS_PLATFORM
227 boost::python::scope().attr(
"platform") =
true;
229 boost::python::scope().attr(
"platform") =
false;
233 boost::python::scope().attr(
"version_major") = JEVOIS_VERSION_MAJOR;
234 boost::python::scope().attr(
"version_minor") = JEVOIS_VERSION_MINOR;
235 boost::python::scope().attr(
"version_patch") = JEVOIS_VERSION_PATCH;
238 boost::python::scope().attr(
"share") = JEVOIS_SHARE_PATH;
239 boost::python::scope().attr(
"pydnn") = JEVOIS_PYDNN_PATH;
242 boost::python::def(
"sendSerial", pythonSendSerial);
243 boost::python::def(
"frameNum", pythonFrameNum);
244 boost::python::def(
"writeCamRegister", pythonWriteCamRegister);
245 boost::python::def(
"readCamRegister", pythonReadCamRegister);
246 boost::python::def(
"writeIMUregister", pythonWriteIMUregister);
247 boost::python::def(
"readIMUregister", pythonReadIMUregister);
248 boost::python::def(
"writeDMPregister", pythonWriteDMPregister);
249 boost::python::def(
"readDMPregister", pythonReadDMPregister);
257 boost::python::def(
"LDEBUG", pythonLDEBUG);
258 boost::python::def(
"LINFO", pythonLINFO);
259 boost::python::def(
"LERROR", pythonLERROR);
260 boost::python::def(
"LFATAL", pythonLFATAL);
276 void (*
imgToStd2)(
float & x,
float & y,
unsigned int const width,
unsigned int const height,
float const eps) =
278 boost::python::def(
"imgToStd",
imgToStd1);
279 boost::python::def(
"imgToStd",
imgToStd2);
282 void (*
stdToImg2)(
float & x,
float & y,
unsigned int const width,
unsigned int const height,
float const eps) =
284 boost::python::def(
"stdToImg",
stdToImg1);
285 boost::python::def(
"stdToImg",
stdToImg2);
293 boost::python::class_<jevois::RawImage>(
"RawImage")
309 boost::python::enum_<jevois::python::YUYV>(
"YUYV")
310 .JEVOIS_PYTHON_ENUM_VAL(
Black)
312 .JEVOIS_PYTHON_ENUM_VAL(
MedGrey)
314 .JEVOIS_PYTHON_ENUM_VAL(
White)
319 .JEVOIS_PYTHON_ENUM_VAL(
MedTeal)
325 .JEVOIS_PYTHON_ENUM_VAL(
MedPink)
337 boost::python::class_<jevois::InputFramePython>(
"InputFrame")
339 boost::python::return_value_policy<boost::python::reference_existing_object>())
341 boost::python::return_value_policy<boost::python::reference_existing_object>())
344 boost::python::return_value_policy<boost::python::reference_existing_object>())
346 boost::python::return_value_policy<boost::python::reference_existing_object>())
348 boost::python::return_value_policy<boost::python::reference_existing_object>())
350 boost::python::return_value_policy<boost::python::reference_existing_object>())
368 boost::python::class_<jevois::OutputFramePython>(
"OutputFrame")
370 boost::python::return_value_policy<boost::python::reference_existing_object>())
411 void (*drawRect2)(
jevois::RawImage & img,
int x,
int y,
unsigned int w,
unsigned int h,
unsigned int col) =
413 boost::python::def(
"drawRect", drawRect1);
414 boost::python::def(
"drawRect", drawRect2);
417 boost::python::enum_<jevois::rawimage::Font>(
"Font")
418 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font5x7)
419 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font6x10)
420 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font7x13)
423 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font10x20)
424 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font11x22)
425 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font12x22)
426 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font14x26)
427 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font15x28)
428 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font16x29)
429 .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(
Font20x38);
431 void (*writeText1)(
jevois::RawImage & img, std::string
const & txt,
int x,
int y,
433 boost::python::def(
"writeText", writeText1);
451 boost::python::class_<jevois::Timer>(
"Timer", boost::python::init<char const *, size_t, int>())
453 .def(
"stop", timer_stop, boost::python::return_value_policy<boost::python::copy_const_reference>());
456 boost::python::class_<jevois::Profiler>(
"Profiler", boost::python::init<char const *, size_t, int>())
459 .def(
"stop", &
jevois::Profiler::stop, boost::python::return_value_policy<boost::python::copy_const_reference>());
473 boost::python::class_<ImVec2>(
"ImVec2", boost::python::init<float, float>())
474 .def_readwrite(
"x", &ImVec2::x)
475 .def_readwrite(
"y", &ImVec2::y);
477 boost::python::class_<ImVec4>(
"ImVec4", boost::python::init<float, float, float, float>())
478 .def_readwrite(
"x", &ImVec4::x)
479 .def_readwrite(
"y", &ImVec4::y)
480 .def_readwrite(
"z", &ImVec4::z)
481 .def_readwrite(
"w", &ImVec4::w);
483 boost::python::class_<ImColor>(
"ImColor", boost::python::init<int, int, int, int>())
484 .def(boost::python::init<float, float, float, float>())
485 .def(boost::python::init<ImU32>())
486 .def_readwrite(
"Value", &ImColor::Value);
488 boost::python::class_<jevois::GUIhelperPython>(
"GUIhelper", boost::python::init<jevois::GUIhelper *>())
531 boost::python::class_<jevois::ParameterCategory>(
"ParameterCategory", boost::python::init<std::string, std::string>())
537 boost::python::def(
"getParamStr", pythonGetParamStringUnique);
538 boost::python::def(
"setParamStr", pythonSetParamStringUnique);
541 boost::python::class_<jevois::PythonParameter>(
"Parameter", boost::python::init<boost::python::object &,
542 std::string
const &, std::string
const &, std::string
const &,
545 boost::python::return_value_policy<boost::python::reference_existing_object>())
558 boost::python::class_<jevois::dnn::PreProcessorForPython>(
"PreProcessor", boost::python::no_init)
568 boost::python::class_<jevois::dnn::PostProcessorDetectYOLOforPython>(
"PyPostYOLO")
576 boost::python::def(
"shapestr", shapestr1);
int getFanSpeed()
Get fan speed in percent, only meaningful on JeVois-Pro Platform, all others return 0.
void convertBayerToYUYV(RawImage const &src, RawImage &dst)
Convert from Bayer to YUYV, only used internally by Camera class.
unsigned int whiteColor(unsigned int fcc)
Return a value that corresponds to white for the given video format.
void sendScaledCvGRAY(cv::Mat const &img) const
Shorthand to send a GRAY cv::Mat after scaling/converting it to the current output format.
void drawDisk(RawImage &img, int x, int y, unsigned int rad, unsigned int col)
Draw a disk in a YUYV image.
void convertCvRGBAtoCvYUYV(cv::Mat const &src, cv::Mat &dst)
OpenCV does not provide conversion from RGBA to YUYV in cvtColor(), so this function provides it.
void imgToStdY(float &y, unsigned int const height, float const eps=0.1F)
Transform Y coordinate in-place from camera to standardized, using given image width and height.
void iinfo(jevois::InputFramePython const &inframe, std::string const &fpscpu, unsigned short winw=0, unsigned short winh=0)
Display processing and video info at bottom of screen.
unsigned int bytesperpix() const
Helper function to get the number of bytes/pixel given the RawImage pixel format.
void clear()
Clear the pixels to all black.
void convertCvRGBtoCvYUYV(cv::Mat const &src, cv::Mat &dst)
OpenCV does not provide conversion from RGB to YUYV in cvtColor(), so this function provides it.
void stdToImgSize(float &x, float &y, unsigned int const width, unsigned int const height, float const eps=0.1F)
Transform size in-place from standardized to image, using a RawImage to establish image size.
#define LDEBUG(msg)
Convenience macro for users to print out console or syslog messages, DEBUG level.
void(* stdToImg1)(float &x, float &y, jevois::RawImage const &camimg, float const eps)
Converter from Python numpy NDarray to cv::Mat.
void sendCv1(cv::Mat const &img, int quality) const
Shorthand to send a cv::Mat after scaling/converting it to the current output format.
boost::python::tuple drawImage1(char const *name, cv::Mat const &img, bool rgb, bool noalias=false, bool isoverlay=false)
Draw an OpenCV image, copying pixel data to an OpenGL texture.
cv::Mat rescaleCv(cv::Mat const &img, cv::Size const &newdims)
Rescale an OpenCV image, choosing the right kind of interpolation.
void convertCvRGBtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a RGB cv::Mat to RawImage with already-allocated pixels and pixel type.
bool isMouseReleased(int button_num)
ImGui helper: check if mouse button released.
std::string description
An optional short description of the category.
unsigned int cvBytesPerPix(unsigned int cvtype)
Return the number of bytes per pixel for a given OpenCV pixel type.
const std::string strget() const
Get the value as a string.
void set(boost::python::object const &newVal)
Set the value of this Parameter.
void flushcache()
Flush the caches, may sometimes be useful when running the camera in turbo mode.
const RawImage & get() const
Get the next captured camera image.
void drawPoly(std::vector< cv::Point > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
std::string getSysInfoMem()
Get memory info.
void checkpoint(char const *description)
Note the time for a particular event.
std::string cvtypestr(unsigned int cvtype)
Convert cv::Mat::type() code to to a string (e.g., CV_8UC1, CV_32SC3, etc)
const std::string & name() const
Get the parameter name.
void itext(char const *txt, ImU32 const &col=IM_COL32_BLACK_TRANS, int line=-1)
Draw some overlay text on top of an image.
boost::python::tuple drawImage3(char const *name, cv::Mat const &img, bool rgb, int x, int y, int w, int h, bool noalias=false, bool isoverlay=false)
Draw an OpenCV image, copying pixel data to an OpenGL texture.
A component of a model hierarchy.
void freeze(bool doit)
Freeze/unfreeze this parameter, it becomes read-only and will not show up in the help message.
void send() const
Indicate that user processing is done with the image previously obtained via get()
unsigned int bytesize() const
Helper function to get the total number of bytes in the RawImage, i.e., width * height * bytesperpix(...
cv::Mat convertToCvRGB(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB byte.
ImVec2 iline(int line=-1, char const *name=nullptr)
Get coordinates of the start of a given line of text to be drawn as overlay on top of an image.
Font
Available fonts for writeText()
void(* stdToImg2)(float &x, float &y, unsigned int const width, unsigned int const height, float const eps)
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
void imgToStdSize(float &w, float &h, unsigned int const width, unsigned int const height, float const eps=0.1F)
Transform size in-place from camera to standardized, using given image width and height.
void sendScaledCvRGBA1(cv::Mat const &img, int quality) const
Shorthand to send a RGBA cv::Mat after scaling/converting it to the current output format.
int stringToRGBA(std::string const &label, unsigned char alpha=128)
Compute a color from a label name.
void drawCircle(RawImage &img, int x, int y, unsigned int rad, unsigned int thick, unsigned int col)
Draw a circle in a YUYV image.
void start()
Start a time measurement period.
std::string getParamStringUnique(std::string const ¶mdescriptor) const
Get a parameter value by string, simple version assuming only one parameter match.
unsigned int blackColor(unsigned int fcc)
Return a value that corresponds to black for the given video format.
bool isMouseDown(int button_num)
ImGui helper: check if mouse button pressed.
cv::Mat convertToCvBGR(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV BGR byte.
void drawPoly1(std::vector< cv::Point2f > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
A category to which multiple ParameterDef definitions can belong.
float fps
Programmed frames/s as given by current video mapping, may not be actual.
bool valid() const
Check whether the image has a valid pixel buffer.
bool frameStarted() const
Helper to indicate that startFrame() was called, and thus endFrame() should be called.
void endFrame()
Finish current frame and render it.
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
cv::Mat convertToCvGray(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV gray byte.
void invalidate()
Invalidate the image by zero'ing out the pointer to pixel buffer and the dims and format.
void imgToStdX(float &x, unsigned int const width, float const eps=0.1F)
Transform X coordinate in-place from camera to standardized, using given image width and height.
void require(char const *info, unsigned int w, unsigned int h, unsigned int f) const
Require a particular image size and format, issue a fatal error message and throw if no match.
void sendScaledCvRGB1(cv::Mat const &img, int quality) const
Shorthand to send a RGB cv::Mat after scaling/converting it to the current output format.
boost::python::tuple imagesize() const
Access the last processed image size.
void strset(std::string const &valstring)
Set the value from a string representation of it.
void drawText(float x, float y, char const *txt, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw text over an image.
std::string getSysInfoVersion()
Get O.S. version info.
bool isMouseDragging(int button_num)
ImGui helper: check if mouse button dragged.
ImVec2 d2i1(float x, float y, char const *name=nullptr)
Convert coordinates of a point from on-screen to within a rendered image.
void roipaste(RawImage const &src, int x, int y, unsigned int w, unsigned int h, RawImage &dest, int dx, int dy)
Paste an ROI from an image to within another of same pixel type.
unsigned int width
Image width in pixels.
const std::string & stop()
Same as the other signature of stop() except does not provide seconds, for python bindings.
void freeze(bool doit)
Freeze/unfreeze parameters that users should not change while running.
std::string shapestr(cv::Mat const &m)
Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional cv::Mat with data type TYPE.
void releaseImage2(char const *name)
Release an image, second video stream.
void writeText(RawImage &img, std::string const &txt, int x, int y, unsigned int col, Font font=Font6x10)
Write some text in an image.
void convertCvGRAYtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a Gray cv::Mat to RawImage with already-allocated pixels and pixel type.
size_t getNumInstalledNPUs()
Get the number of JeVois-Pro NPUs present on this system.
std::string getSysInfoCPU()
Get CPU info: frequency, thermal, load.
ImVec2 d2is1(float x, float y, char const *name=nullptr)
Convert a 2D size from on-screen to within a rendered image.
boost::python::tuple startFrame()
Start a new rendering frame.
void sendCvGRAY1(cv::Mat const &img, int quality) const
Shorthand to send a GRAY cv::Mat after converting it to the current output format.
std::string system(std::string const &cmd, bool errtoo=true)
Execute a command and grab stdout output to a string.
void stdToImg(float &x, float &y, RawImage const &camimg, float const eps=0.1F)
Transform coordinates in-place from standardized to image, using a RawImage to establish image size.
bool hasattr(boost::python::object &o, char const *name)
Check whether a boost::python::object has an attribute.
void sendCvRGBA(cv::Mat const &img) const
Shorthand to send a RGBA cv::Mat after converting it to the current output format.
void sendCvRGB1(cv::Mat const &img, int quality) const
Shorthand to send a RGB cv::Mat after converting it to the current output format.
unsigned int v4l2BytesPerPix(unsigned int fcc)
Return the number of bytes per pixel for a given V4L2_PIX_FMT_...
void reportAndIgnoreException(std::string const &prefix="")
Report current exception in a modal dialog, then ignore it.
boost::python::tuple i2b(float x, float y, size_t blobnum)
Convert coordinates from image to blob.
boost::python::tuple drawImage(char const *name, RawImage const &img, bool noalias=false, bool isoverlay=false)
Draw a RawImage, copying pixel data to an OpenGL texture.
bool isMouseDoubleClicked(int button_num)
ImGui helper: check if mouse button double-clicked.
ImVec2 i2ds1(float x, float y, char const *name=nullptr)
Convert a 2D size from within a rendered image to on-screen.
#define JEVOIS_PYTHON_CONSTANT(cst)
size_t getNumInstalledTPUs()
Get the number of Coral TPUs present on this system.
boost::python::object get() const
Get the value of this Parameter.
void drawPoly2(cv::Mat const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
Engine * engineForPythonModule
ImVec2 i2d1(float x, float y, char const *name=nullptr)
Convert coordinates of a point from within a rendered image to on-screen.
void setCallback(boost::python::object const &cb)
Set the parameter's callback.
std::string fccstr(unsigned int fcc)
Convert a V4L2 four-cc code (V4L2_PIX_FMT_...) to a 4-char string.
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
boost::python::list blobs() const
Access the last computed blobs (or empty if process() has not yet been called)
void drawFilledRect(RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int col)
Draw a filled rectangle in a YUYV image.
void sendScaledCvGRAY1(cv::Mat const &img, int quality) const
Shorthand to send a GRAY cv::Mat after scaling/converting it to the current output format.
void sendScaledCvRGBA(cv::Mat const &img) const
Shorthand to send a RGBA cv::Mat after scaling/converting it to the current output format.
ImVec2 d2i(ImVec2 p, char const *name=nullptr)
Convert coordinates of a point from on-screen to within a rendered image.
void hFlipYUYV(RawImage &img)
Flip a YUYV RawImage horizontally while preserving color information.
void convertCvRGBAtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert an RGBA cv::Mat to RawImage with already-allocated pixels and pixel type.
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
size_t getNumInstalledSPUs()
Get the number of Hailo8 SPUs present on this system.
ImVec2 getMousePos()
ImGui helper: get mouse position.
void convertCvBGRtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a BGR cv::Mat to RawImage with already-allocated pixels and pixel type.
void unpackCvRGBAtoGrayRawImage(cv::Mat const &src, RawImage &dst)
Split an RGBA cv::Mat into a 4x taller grey RawImage with already-allocated pixels.
bool isMouseClicked(int button_num)
ImGui helper: check if mouse button clicked.
void setEngine(jevois::Engine *e)
Initialize Python, numpy, and allow python modules to send serial outputs through the JeVois Engine.
#define JEVOIS_PYTHON_FUNC(funcname)
ImVec2 i2ds(ImVec2 p, char const *name=nullptr)
Convert a 2D size from within a rendered image to on-screen.
size_t getNumInstalledVPUs()
Get the number of Myriad-X VPUs present on this system.
void sendScaledCvRGB(cv::Mat const &img) const
Shorthand to send a RGB cv::Mat after scaling/converting it to the current output format.
void sendCvRGB(cv::Mat const &img) const
Shorthand to send a RGB cv::Mat after converting it to the current output format.
unsigned int height
Image height in pixels.
void start()
Start a time measurement period.
void reset()
Reset this parameter to its default value.
void imgToStd(float &x, float &y, RawImage const &camimg, float const eps=0.1F)
Transform coordinates in-place from camera to standardized, using a RawImage to establish image size.
void drawRect(float x1, float y1, float x2, float y2, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw rectangular box over an image.
bool coordsOk(int x, int y) const
Helper function to check that coords are within image bounds.
void sendScaledCvBGR1(cv::Mat const &img, int quality) const
Shorthand to send a BGR cv::Mat after scaling/converting it to the current output format.
cv::Mat cvImage(RawImage const &src)
Create an OpenCV image from the existing RawImage data, sharing the pixel memory rather than copying ...
boost::python::tuple getUnscaledCropRect(size_t blobnum)
Get unscaled crop rectangle in image coordinates.
void releaseImage(char const *name)
Release an image.
void sendCvRGBA1(cv::Mat const &img, int quality) const
Shorthand to send a RGBA cv::Mat after converting it to the current output format.
void sendCvBGR(cv::Mat const &img) const
Shorthand to send a BGR cv::Mat after converting it to the current output format.
#define JEVOIS_PYTHON_RAWIMAGE_FUNC(funcname)
void paste(RawImage const &src, RawImage &dest, int dx, int dy)
Paste an image within another of same pixel type.
boost::python::tuple blobsize(size_t num) const
Access the width and height of a given blob, accounting for NCHW or NHWC.
void drawRect(RawImage &img, int x, int y, unsigned int w, unsigned int h, unsigned int thick, unsigned int col)
Draw a rectangle in a YUYV image.
unsigned int fmt
Pixel format as a V4L2_PIX_FMT_XXX.
boost::python::tuple drawImage2(char const *name, RawImage const &img, int x, int y, int w, int h, bool noalias=false, bool isoverlay=false)
Draw an OpenCV image, copying pixel data to an OpenGL texture.
unsigned int v4l2ImageSize(unsigned int fcc, unsigned int width, unsigned int height)
Return the image size in bytes for a given V4L2_PIX_FMT_..., width, height.
void(* imgToStd1)(float &x, float &y, jevois::RawImage const &camimg, float const eps)
void drawLine(float x1, float y1, float x2, float y2, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw line over an image.
std::string name
The name of the category.
void stop()
End a time measurement period, report time spent for each checkpoint if reporting interval is reached...
cv::Mat convertToCvRGBA(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB-A byte...
boost::python::tuple drawInputFrame(char const *name, InputFramePython const &frame, bool noalias=false, bool casync=false)
Draw the input video frame from the camera using zero-copy.
ImVec2 i2d(ImVec2 p, char const *name=nullptr)
Convert coordinates of a point from within a rendered image to on-screen.
void convertCvBGRtoCvYUYV(cv::Mat const &src, cv::Mat &dst)
OpenCV does not provide conversion from BGR to YUYV in cvtColor(), so this function provides it.
void drawCircle(float x, float y, float r, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw circle over an image.
void drawLine(RawImage &img, int x1, int y1, int x2, int y2, unsigned int thick, unsigned int col)
Draw a line in a YUYV image.
boost::python::tuple drawInputFrame2(char const *name, InputFramePython const &frame, bool noalias=false, bool casync=false)
Draw the second (scaled) input video frame from the camera using zero-copy.
std::string descriptor() const
Get the parameter fully-qualified name, aka descriptor, including names of owning Component and all p...
boost::python::tuple yolo(boost::python::list outs, int nclass, float boxThreshold, float confThreshold, int bw, int bh, int fudge, int maxbox)
Generic raw YOLO processing.
void sendCv(cv::Mat const &img) const
Shorthand to send a cv::Mat after scaling/converting it to the current output format.
unsigned int strfcc(std::string const &str)
Convert a JeVois video format string to V4L2 four-cc code (V4L2_PIX_FMT_...)
void pasteGreyToYUYV(cv::Mat const &src, RawImage &dest, int dx, int dy)
Paste a grey byte image into a YUYV image.
#define LINFO(msg)
Convenience macro for users to print out console or syslog messages, INFO level.
void setParamStringUnique(std::string const ¶mdescriptor, std::string const &val)
Set a parameter value by string, simple version assuming only one parameter match.
void convertGreyToYUYV(RawImage const &src, RawImage &dst)
Convert from Grey (monochrome) to YUYV, only used internally by Camera class.
void reportAndRethrowException(std::string const &prefix="")
Report current exception in a modal dialog, then re-throw it.
void(* imgToStd2)(float &x, float &y, unsigned int const width, unsigned int const height, float const eps)
boost::python::tuple b2i(float x, float y, size_t blobnum)
Convert coordinates from blob back to original image.
void byteSwap(RawImage &img)
Swap pairs of bytes in a RawImage.
void convertCvGRAYtoCvYUYV(cv::Mat const &src, cv::Mat &dst)
OpenCV does not provide conversion from GRAY to YUYV in cvtColor(), so this function provides it.
void reportError(std::string const &err)
Report an error in an overlay window.
void sendCvGRAY(cv::Mat const &img) const
Shorthand to send a GRAY cv::Mat after converting it to the current output format.
ImVec2 d2is(ImVec2 p, char const *name=nullptr)
Convert a 2D size from on-screen to within a rendered image.
void sendScaledCvBGR(cv::Mat const &img) const
Shorthand to send a BGR cv::Mat after scaling/converting it to the current output format.
void sendCvBGR1(cv::Mat const &img, int quality) const
Shorthand to send a BGR cv::Mat after converting it to the current output format.
#define JEVOIS_PYTHON_DNN_FUNC(funcname)