JeVois  1.17
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
PythonSupport.C
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 #include <boost/python.hpp>
19 
21 #include <jevois/Core/Engine.H>
22 #include <jevois/Image/RawImage.H>
27 #include <jevois/Core/Serial.H>
28 #include <jevois/Util/Utils.H>
30 #include <jevois/Debug/Log.H>
31 #include <jevois/Debug/Timer.H>
32 #include <jevois/Debug/Profiler.H>
33 #include <jevois/Debug/SysInfo.H>
34 #include <jevois/Core/Camera.H>
35 #include <jevois/Core/IMU.H>
36 
37 #define PY_ARRAY_UNIQUE_SYMBOL pbcvt_ARRAY_API
39 
40 // ####################################################################################################
41 // Convenience macro to define a Python binding for a free function in the jevois namespace
42 #define JEVOIS_PYTHON_FUNC(funcname) \
43  boost::python::def(#funcname, jevois::funcname)
44 
45 // Convenience macro to define a Python binding for a free function in the jevois::rawimage namespace
46 #define JEVOIS_PYTHON_RAWIMAGE_FUNC(funcname) \
47  boost::python::def(#funcname, jevois::rawimage::funcname)
48 
49 // Convenience macro to define a python enum value where the value is in jevois::rawimage
50 #define JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(val) value(#val, jevois::rawimage::val)
51 
52 // Convenience macro to define a python enum value where the value is in jevois::python
53 #define JEVOIS_PYTHON_ENUM_VAL(val) value(#val, jevois::python::val)
54 
55 // Convenience macro to define a constant that exists in the global C++ namespace
56 #define JEVOIS_PYTHON_CONSTANT(cst) boost::python::scope().attr(#cst) = cst;
57 
58 
59 // ####################################################################################################
60 // Helper to provide jevois.sendSerial() function that emulates a C++ module's sendSerial()
61 namespace jevois
62 {
63  namespace python
64  {
66  }
67 }
68 
69 namespace
70 {
71  void * init_numpy()
72  {
73  // Initialize Python:
74  Py_SetProgramName(Py_DecodeLocale("", nullptr)); // black magic
75  Py_Initialize();
76 
77  // Initialize numpy array. Use the signal handler hack to prevent numpy from grabbing CTRL-C from
78  // https://stackoverflow.com/questions/28750774/
79  // python-import-array-makes-it-impossible-to-kill-embedded-python-with-ctrl-c
80  //PyOS_sighandler_t sighandler = PyOS_getsig(SIGINT);
81  import_array();
82  //PyOS_setsig(SIGINT,sighandler);
83  return nullptr; // was NUMPY_IMPORT_ARRAY_RETVAL in older numpy
84  }
85 }
86 
87 void jevois::pythonModuleSetEngine(jevois::Engine * e)
88 {
90  init_numpy();
91 }
92 
93 // ####################################################################################################
94 // Thin wrappers to handle default arguments or overloads in free functions
95 
96 namespace
97 {
98  void pythonSendSerial(std::string const & str)
99  {
100  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
102  }
103 
104  size_t pythonFrameNum()
105  {
106  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
108  }
109 
110  void pythonWriteCamRegister(unsigned short reg, unsigned short val)
111  {
112  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
114  if (!cam) LFATAL("Not using a Camera for video input");
115  cam->writeRegister(reg, val);
116  }
117 
118  unsigned short pythonReadCamRegister(unsigned short reg)
119  {
120  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
122  if (!cam) LFATAL("Not using a Camera for video input");
123  return cam->readRegister(reg);
124  }
125 
126  void pythonWriteIMUregister(unsigned short reg, unsigned short val)
127  {
128  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
130  if (!imu) LFATAL("No IMU driver loaded");
131  imu->writeRegister(reg, val);
132  }
133 
134  unsigned short pythonReadIMUregister(unsigned short reg)
135  {
136  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
138  if (!imu) LFATAL("No IMU driver loaded");
139  return imu->readRegister(reg);
140  }
141 
142  void pythonWriteDMPregister(unsigned short reg, unsigned short val)
143  {
144  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
146  if (!imu) LFATAL("No IMU driver loaded");
147  imu->writeDMPregister(reg, val);
148  }
149 
150  unsigned short pythonReadDMPregister(unsigned short reg)
151  {
152  if (jevois::python::engineForPythonModule == nullptr) LFATAL("internal error");
154  if (!imu) LFATAL("No IMU driver loaded");
155  return imu->readDMPregister(reg);
156  }
157 
158 #ifdef JEVOIS_LDEBUG_ENABLE
159  void pythonLDEBUG(std::string const & logmsg) { LDEBUG(logmsg); }
160 #else
161  void pythonLDEBUG(std::string const & JEVOIS_UNUSED_PARAM(logmsg)) { }
162 #endif
163  void pythonLINFO(std::string const & logmsg) { LINFO(logmsg); }
164  void pythonLERROR(std::string const & logmsg) { LERROR(logmsg); }
165  void pythonLFATAL(std::string const & logmsg) { LFATAL(logmsg); }
166 
167 } // anonymous namespace
168 
169 namespace jevois
170 {
171  namespace python
172  {
173  // Aux enum for YUYV colors - keep this in sync with RawImage.H:
174  enum YUYV { Black = 0x8000, DarkGrey = 0x8050, MedGrey = 0x8080, LightGrey = 0x80a0, White = 0x80ff,
175  DarkGreen = 0x0000, MedGreen = 0x0040, LightGreen = 0x00ff, DarkTeal = 0x7070, MedTeal = 0x7090,
176  LightTeal = 0x70b0, DarkPurple = 0xa030, MedPurple = 0xa050, LightPurple = 0xa080,
177  DarkPink = 0xff00, MedPink = 0xff80, LightPink = 0xffff };
178  }
179 }
180 
181 // ####################################################################################################
182 #ifdef JEVOIS_PRO
183 BOOST_PYTHON_MODULE(libjevoispro)
184 #else
185 BOOST_PYTHON_MODULE(libjevois)
186 #endif
187 {
188  // #################### Initialize converters for cv::Mat support:
189  boost::python::to_python_converter<cv::Mat, pbcvt::matToNDArrayBoostConverter>();
191 
192  // #################### module sendSerial() and other functions emulation:
193  boost::python::def("sendSerial", pythonSendSerial);
194  boost::python::def("frameNum", pythonFrameNum);
195  boost::python::def("writeCamRegister", pythonWriteCamRegister);
196  boost::python::def("readCamRegister", pythonReadCamRegister);
197  boost::python::def("writeIMUregister", pythonWriteIMUregister);
198  boost::python::def("readIMUregister", pythonReadIMUregister);
199  boost::python::def("writeDMPregister", pythonWriteDMPregister);
200  boost::python::def("readDMPregister", pythonReadDMPregister);
201 
202  // #################### Log.H
203  JEVOIS_PYTHON_CONSTANT(LOG_DEBUG);
204  JEVOIS_PYTHON_CONSTANT(LOG_INFO);
205  JEVOIS_PYTHON_CONSTANT(LOG_ERR);
206  JEVOIS_PYTHON_CONSTANT(LOG_CRIT);
207 
208  boost::python::def("LDEBUG", pythonLDEBUG);
209  boost::python::def("LINFO", pythonLINFO);
210  boost::python::def("LERROR", pythonLERROR);
211  boost::python::def("LFATAL", pythonLFATAL);
212 
213  // #################### Utils.H
224 
225  // #################### Coordinates.H
226  void (*imgToStd1)(float & x, float & y, jevois::RawImage const & camimg, float const eps) = jevois::coords::imgToStd;
227  void (*imgToStd2)(float & x, float & y, unsigned int const width, unsigned int const height, float const eps) =
229  boost::python::def("imgToStd", imgToStd1);
230  boost::python::def("imgToStd", imgToStd2);
231 
232  void (*stdToImg1)(float & x, float & y, jevois::RawImage const & camimg, float const eps) = jevois::coords::stdToImg;
233  void (*stdToImg2)(float & x, float & y, unsigned int const width, unsigned int const height, float const eps) =
235  boost::python::def("stdToImg", stdToImg1);
236  boost::python::def("stdToImg", stdToImg2);
237 
238  boost::python::def("imgToStdX", jevois::coords::imgToStdX);
239  boost::python::def("imgToStdY", jevois::coords::imgToStdY);
240  boost::python::def("imgToStdSize", jevois::coords::imgToStdSize);
241  boost::python::def("stdToImgSize", jevois::coords::stdToImgSize);
242 
243  // #################### RawImage.H
244  boost::python::class_<jevois::RawImage>("RawImage") // default constructor is included
245  .def("invalidate", &jevois::RawImage::invalidate)
246  .def("valid", &jevois::RawImage::valid)
247  .def("clear", &jevois::RawImage::clear)
248  .def("require", &jevois::RawImage::require)
249  .def_readwrite("width", &jevois::RawImage::width)
250  .def_readwrite("height", &jevois::RawImage::height)
251  .def_readwrite("fmt", &jevois::RawImage::fmt)
252  .def_readwrite("fps", &jevois::RawImage::fps)
253  .def("bytesperpix", &jevois::RawImage::bytesperpix)
254  .def("bytesize", &jevois::RawImage::bytesize)
255  .def("coordsOk", &jevois::RawImage::coordsOk)
256  //.def("pixels", &jevois::RawImage::pixelsw<unsigned char>,
257  // boost::python::return_value_policy<boost::python::reference_existing_object>())
258  ;
259 
260  boost::python::enum_<jevois::python::YUYV>("YUYV")
261  .JEVOIS_PYTHON_ENUM_VAL(Black)
262  .JEVOIS_PYTHON_ENUM_VAL(DarkGrey)
263  .JEVOIS_PYTHON_ENUM_VAL(MedGrey)
264  .JEVOIS_PYTHON_ENUM_VAL(LightGrey)
265  .JEVOIS_PYTHON_ENUM_VAL(White)
266  .JEVOIS_PYTHON_ENUM_VAL(DarkGreen)
267  .JEVOIS_PYTHON_ENUM_VAL(MedGreen)
268  .JEVOIS_PYTHON_ENUM_VAL(LightGreen)
269  .JEVOIS_PYTHON_ENUM_VAL(DarkTeal)
270  .JEVOIS_PYTHON_ENUM_VAL(MedTeal)
271  .JEVOIS_PYTHON_ENUM_VAL(LightTeal)
272  .JEVOIS_PYTHON_ENUM_VAL(DarkPurple)
273  .JEVOIS_PYTHON_ENUM_VAL(MedPurple)
274  .JEVOIS_PYTHON_ENUM_VAL(LightPurple)
275  .JEVOIS_PYTHON_ENUM_VAL(DarkPink)
276  .JEVOIS_PYTHON_ENUM_VAL(MedPink)
277  .JEVOIS_PYTHON_ENUM_VAL(LightPink)
278  ;
279 
280  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_SRGGB8);
281  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_YUYV);
282  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_GREY);
283  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_RGB565);
284  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_MJPEG);
285  JEVOIS_PYTHON_CONSTANT(V4L2_PIX_FMT_BGR24);
286 
287  // #################### PythonModule.H
288  boost::python::class_<jevois::InputFramePython>("InputFrame")
289  .def("get", &jevois::InputFramePython::get1,
290  boost::python::return_value_policy<boost::python::reference_existing_object>())
291  .def("get", &jevois::InputFramePython::get,
292  boost::python::return_value_policy<boost::python::reference_existing_object>())
293  .def("hasScaledImage", &jevois::InputFramePython::hasScaledImage)
294  .def("get2", &jevois::InputFramePython::get21,
295  boost::python::return_value_policy<boost::python::reference_existing_object>())
296  .def("get2", &jevois::InputFramePython::get2,
297  boost::python::return_value_policy<boost::python::reference_existing_object>())
298  .def("getp", &jevois::InputFramePython::getp1,
299  boost::python::return_value_policy<boost::python::reference_existing_object>())
300  .def("getp", &jevois::InputFramePython::getp,
301  boost::python::return_value_policy<boost::python::reference_existing_object>())
302  .def("done", &jevois::InputFramePython::done)
303  .def("done2", &jevois::InputFramePython::done2)
304  .def("getCvGRAY", &jevois::InputFramePython::getCvGRAY1)
305  .def("getCvGRAY", &jevois::InputFramePython::getCvGRAY)
306  .def("getCvBGR", &jevois::InputFramePython::getCvBGR1)
307  .def("getCvBGR", &jevois::InputFramePython::getCvBGR)
308  .def("getCvRGB", &jevois::InputFramePython::getCvRGB1)
309  .def("getCvRGB", &jevois::InputFramePython::getCvRGB)
310  .def("getCvRGBA", &jevois::InputFramePython::getCvRGBA1)
311  .def("getCvRGBA", &jevois::InputFramePython::getCvRGBA)
312 
313  .def("getCvGRAYp", &jevois::InputFramePython::getCvGRAYp)
314  .def("getCvBGRp", &jevois::InputFramePython::getCvBGRp)
315  .def("getCvRGBp", &jevois::InputFramePython::getCvRGBp)
316  .def("getCvRGBAp", &jevois::InputFramePython::getCvRGBAp)
317  ;
318 
319  boost::python::class_<jevois::OutputFramePython>("OutputFrame")
320  .def("get", &jevois::OutputFramePython::get,
321  boost::python::return_value_policy<boost::python::reference_existing_object>())
322  .def("send", &jevois::OutputFramePython::send)
323 
324  .def("sendCv", &jevois::OutputFramePython::sendCv1)
325  .def("sendCv", &jevois::OutputFramePython::sendCv)
326 
327  .def("sendCvGRAY", &jevois::OutputFramePython::sendCvGRAY1)
328  .def("sendCvGRAY", &jevois::OutputFramePython::sendCvGRAY)
329  .def("sendCvBGR", &jevois::OutputFramePython::sendCvBGR1)
330  .def("sendCvBGR", &jevois::OutputFramePython::sendCvBGR)
331  .def("sendCvRGB", &jevois::OutputFramePython::sendCvRGB1)
332  .def("sendCvRGB", &jevois::OutputFramePython::sendCvRGB)
333  .def("sendCvRGBA", &jevois::OutputFramePython::sendCvRGBA1)
334  .def("sendCvRGBA", &jevois::OutputFramePython::sendCvRGBA)
335 
336  .def("sendScaledCvGRAY", &jevois::OutputFramePython::sendScaledCvGRAY1)
337  .def("sendScaledCvGRAY", &jevois::OutputFramePython::sendScaledCvGRAY)
338  .def("sendScaledCvBGR", &jevois::OutputFramePython::sendScaledCvBGR1)
339  .def("sendScaledCvBGR", &jevois::OutputFramePython::sendScaledCvBGR)
340  .def("sendScaledCvRGB", &jevois::OutputFramePython::sendScaledCvRGB1)
341  .def("sendScaledCvRGB", &jevois::OutputFramePython::sendScaledCvRGB)
342  .def("sendScaledCvRGBA", &jevois::OutputFramePython::sendScaledCvRGBA1)
343  .def("sendScaledCvRGBA", &jevois::OutputFramePython::sendScaledCvRGBA)
344  ;
345 
346  // #################### RawImageOps.H
359 
360  void (*drawRect1)(jevois::RawImage & img, int x, int y, unsigned int w,
361  unsigned int h, unsigned int thick, unsigned int col) = jevois::rawimage::drawRect;
362  void (*drawRect2)(jevois::RawImage & img, int x, int y, unsigned int w, unsigned int h, unsigned int col) =
364  boost::python::def("drawRect", drawRect1);
365  boost::python::def("drawRect", drawRect2);
367 
368  boost::python::enum_<jevois::rawimage::Font>("Font")
369  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font5x7)
370  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font6x10)
371  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font7x13)
372  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font8x13bold)
373  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font9x15bold)
374  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font10x20)
375  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font11x22)
376  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font12x22)
377  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font14x26)
378  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font15x28)
379  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font16x29)
380  .JEVOIS_PYTHON_RAWIMAGE_ENUM_VAL(Font20x38);
381 
382  void (*writeText1)(jevois::RawImage & img, std::string const & txt, int x, int y,
383  unsigned int col, jevois::rawimage::Font font) = jevois::rawimage::writeText;
384  boost::python::def("writeText", writeText1);
385 
398  boost::python::def("rescaleCv", jevois::rescaleCv);
399 
400  // #################### Timer.H
401  std::string const & (jevois::Timer::*timer_stop)() = &jevois::Timer::stop; // select overload with no args
402  boost::python::class_<jevois::Timer>("Timer", boost::python::init<char const *, size_t, int>())
403  .def("start", &jevois::Timer::start)
404  .def("stop", timer_stop, boost::python::return_value_policy<boost::python::copy_const_reference>());
405 
406  // #################### Profiler.H
407  boost::python::class_<jevois::Profiler>("Profiler", boost::python::init<char const *, size_t, int>())
408  .def("start", &jevois::Profiler::start)
409  .def("checkpoint", &jevois::Profiler::checkpoint)
410  .def("stop", &jevois::Profiler::stop, boost::python::return_value_policy<boost::python::copy_const_reference>());
411 
412  // #################### SysInfo.H
416 
417 #ifdef JEVOIS_PRO
418  // #################### GUIhelper.H
419  boost::python::class_<ImVec2>("ImVec2");
420  boost::python::class_<ImColor>("ImColor");
421 
422  boost::python::class_<jevois::GUIhelperPython>("GUIhelper")
423  .def("startFrame", &jevois::GUIhelperPython::startFrame)
424  .def("frameStarted", &jevois::GUIhelperPython::frameStarted)
425  .def("drawImage", &jevois::GUIhelperPython::drawImage)
426  .def("drawImage", &jevois::GUIhelperPython::drawImage1)
427  .def("drawInputFrame", &jevois::GUIhelperPython::drawInputFrame)
428  .def("drawInputFrame2", &jevois::GUIhelperPython::drawInputFrame2)
429  .def("i2d", &jevois::GUIhelperPython::i2d)
430  .def("i2d", &jevois::GUIhelperPython::i2d1)
431  .def("i2ds", &jevois::GUIhelperPython::i2ds)
432  .def("i2ds", &jevois::GUIhelperPython::i2ds1)
433  .def("drawLine", &jevois::GUIhelperPython::drawLine)
434  .def("drawRect", &jevois::GUIhelperPython::drawRect)
435  .def("drawPoly", &jevois::GUIhelperPython::drawPoly)
436  .def("drawPoly", &jevois::GUIhelperPython::drawPoly1)
437  .def("drawPoly", &jevois::GUIhelperPython::drawPoly2)
438  .def("drawCircle", &jevois::GUIhelperPython::drawCircle)
439  .def("drawText", &jevois::GUIhelperPython::drawText)
440  .def("iline", &jevois::GUIhelperPython::iline)
441  .def("itext", &jevois::GUIhelperPython::itext)
442  .def("iinfo", &jevois::GUIhelperPython::iinfo)
443  .def("releaseImage", &jevois::GUIhelperPython::releaseImage)
444  .def("releaseImage2", &jevois::GUIhelperPython::releaseImage2)
445  .def("endFrame", &jevois::GUIhelperPython::endFrame)
446  .def("reportError", &jevois::GUIhelperPython::reportError)
447  .def("reportAndIgnoreException", &jevois::GUIhelperPython::reportAndIgnoreException)
448  .def("reportAndRethrowException", &jevois::GUIhelperPython::reportAndRethrowException)
449  ;
450 #endif
451 
452 }
jevois::rawimage::convertBayerToYUYV
void convertBayerToYUYV(RawImage const &src, RawImage &dst)
Convert from Bayer to YUYV, only used internally by Camera class.
Definition: RawImageOps.C:1593
jevois::rawimage::Font15x28
@ Font15x28
Definition: RawImageOps.H:163
jevois::whiteColor
unsigned int whiteColor(unsigned int fcc)
Return a value that corresponds to white for the given video format.
Definition: Utils.C:187
jevois::OutputFramePython::sendScaledCvGRAY
void sendScaledCvGRAY(cv::Mat const &img) const
Shorthand to send a GRAY cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:239
jevois::rawimage::drawDisk
void drawDisk(RawImage &img, int x, int y, unsigned int rad, unsigned int col)
Draw a disk in a YUYV image.
Definition: RawImageOps.C:465
jevois::InputFramePython::getCvRGB1
cv::Mat getCvRGB1(bool casync) const
Shorthand to get the input image as a RGB cv::Mat and release the raw buffer.
Definition: PythonModule.C:107
jevois::rawimage::convertCvRGBAtoCvYUYV
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.
Definition: RawImageOps.C:1256
jevois::rawimage::Font20x38
@ Font20x38
Definition: RawImageOps.H:165
jevois::coords::imgToStdY
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.
Definition: Coordinates.C:43
jevois::InputFramePython::getCvGRAY
cv::Mat getCvGRAY() const
Shorthand to get the input image as a GRAY cv::Mat and release the raw buffer.
Definition: PythonModule.C:89
jevois::rawimage::Font9x15bold
@ Font9x15bold
Definition: RawImageOps.H:158
jevois::GUIhelperPython::iinfo
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.
Definition: PythonModule.C:445
jevois::python::LightGreen
@ LightGreen
Definition: PythonSupport.C:175
jevois::RawImage::bytesperpix
unsigned int bytesperpix() const
Helper function to get the number of bytes/pixel given the RawImage pixel format.
Definition: RawImage.C:34
jevois::RawImage::clear
void clear()
Clear the pixels to all black.
Definition: RawImage.C:50
jevois::rawimage::convertCvRGBtoCvYUYV
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.
Definition: RawImageOps.C:1112
PythonSupport.H
jevois::coords::stdToImgSize
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.
Definition: Coordinates.C:74
Coordinates.H
LDEBUG
#define LDEBUG(msg)
Convenience macro for users to print out console or syslog messages, DEBUG level.
Definition: Log.H:160
stdToImg1
void(* stdToImg1)(float &x, float &y, jevois::RawImage const &camimg, float const eps)
Definition: PythonSupport.C:232
pbcvt::matFromNDArrayBoostConverter
Converter from Python numpy NDarray to cv::Mat.
Definition: PythonOpenCV.H:107
jevois::InputFramePython::get
const RawImage & get() const
Get the next captured camera image, thin wrapper for default arg value.
Definition: PythonModule.C:35
jevois::OutputFramePython::sendCv1
void sendCv1(cv::Mat const &img, int quality) const
Shorthand to send a cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:173
RawImageOps.H
jevois::GUIhelperPython::drawImage1
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.
Definition: PythonModule.C:315
jevois::rescaleCv
cv::Mat rescaleCv(cv::Mat const &img, cv::Size const &newdims)
Rescale an OpenCV image, choosing the right kind of interpolation.
Definition: RawImageOps.C:1624
jevois::rawimage::convertCvRGBtoRawImage
void convertCvRGBtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a RGB cv::Mat to RawImage with already-allocated pixels and pixel type.
Definition: RawImageOps.C:1289
jevois::python::MedPurple
@ MedPurple
Definition: PythonSupport.C:176
jevois::cvBytesPerPix
unsigned int cvBytesPerPix(unsigned int cvtype)
Return the number of bytes per pixel for a given OpenCV pixel type.
Definition: Utils.C:88
jevois::rawimage::Font14x26
@ Font14x26
Definition: RawImageOps.H:162
jevois::flushcache
void flushcache()
Flush the caches, may sometimes be useful when running the camera in turbo mode.
Definition: Utils.C:411
jevois::python::MedGreen
@ MedGreen
Definition: PythonSupport.C:175
jevois::OutputFramePython::get
const RawImage & get() const
Get the next captured camera image.
Definition: PythonModule.C:161
jevois::GUIhelperPython::drawPoly
void drawPoly(std::vector< cv::Point > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
Definition: PythonModule.C:387
jevois::getSysInfoMem
std::string getSysInfoMem()
Get memory info.
Definition: SysInfo.C:66
jevois::Profiler::checkpoint
void checkpoint(char const *description)
Note the time for a particular event.
Definition: Profiler.C:39
jevois::cvtypestr
std::string cvtypestr(unsigned int cvtype)
Convert cv::Mat::type() code to to a string (e.g., CV_8UC1, CV_32SC3, etc)
Definition: Utils.C:57
jevois::python::DarkGrey
@ DarkGrey
Definition: PythonSupport.C:174
jevois::InputFramePython::get1
const RawImage & get1(bool casync) const
Get the next captured camera image, thin wrapper for default arg value.
Definition: PythonModule.C:29
jevois::InputFramePython::getCvGRAYp
cv::Mat getCvGRAYp() const
Shorthand to get the input image for processing as a GRAY cv::Mat and release the raw buffer.
Definition: PythonModule.C:131
jevois::GUIhelperPython::itext
void itext(char const *txt, ImU32 const &col=IM_COL32_BLACK_TRANS, int line=-1)
Draw some overlay text on top of an image.
Definition: PythonModule.C:438
RawImage.H
jevois::OutputFramePython::send
void send() const
Indicate that user processing is done with the image previously obtained via get()
Definition: PythonModule.C:167
jevois::InputFramePython::getp
const RawImage & getp() const
Get the next captured camera image that is intended for processing.
Definition: PythonModule.C:65
jevois::RawImage::bytesize
unsigned int bytesize() const
Helper function to get the total number of bytes in the RawImage, i.e., width * height * bytesperpix(...
Definition: RawImage.C:38
jevois::rawimage::convertToCvRGB
cv::Mat convertToCvRGB(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB byte.
Definition: RawImageOps.C:307
jevois::Engine::camera
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:1225
StdioInterface.H
jevois::GUIhelperPython::iline
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.
Definition: PythonModule.C:431
jevois::InputFramePython::getCvRGBp
cv::Mat getCvRGBp() const
Shorthand to get the input image for processing as a RGB cv::Mat and release the raw buffer.
Definition: PythonModule.C:143
jevois::rawimage::Font
Font
Available fonts for writeText()
Definition: RawImageOps.H:152
stdToImg2
void(* stdToImg2)(float &x, float &y, unsigned int const width, unsigned int const height, float const eps)
Definition: PythonSupport.C:233
jevois::RawImage
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition: RawImage.H:110
jevois::coords::imgToStdSize
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.
Definition: Coordinates.C:50
jevois::OutputFramePython::sendScaledCvRGBA1
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.
Definition: PythonModule.C:269
jevois::rawimage::drawCircle
void drawCircle(RawImage &img, int x, int y, unsigned int rad, unsigned int thick, unsigned int col)
Draw a circle in a YUYV image.
Definition: RawImageOps.C:483
jevois::InputFramePython::done
void done() const
Indicate that user processing is done with the image previously obtained via get()
Definition: PythonModule.C:71
jevois::Timer::start
void start()
Start a time measurement period.
Definition: Timer.C:40
UserInterface.H
jevois::blackColor
unsigned int blackColor(unsigned int fcc)
Return a value that corresponds to black for the given video format.
Definition: Utils.C:165
jevois::rawimage::convertToCvBGR
cv::Mat convertToCvBGR(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV BGR byte.
Definition: RawImageOps.C:282
jevois::GUIhelperPython::drawPoly1
void drawPoly1(std::vector< cv::Point2f > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
Definition: PythonModule.C:394
jevois::rawimage::Font6x10
@ Font6x10
Definition: RawImageOps.H:155
jevois::RawImage::fps
float fps
Programmed frames/s as given by current video mapping, may not be actual.
Definition: RawImage.H:148
jevois::python::LightGrey
@ LightGrey
Definition: PythonSupport.C:174
jevois::RawImage::valid
bool valid() const
Check whether the image has a valid pixel buffer.
Definition: RawImage.C:46
jevois::GUIhelperPython::frameStarted
bool frameStarted() const
Helper to indicate that startFrame() was called, and thus endFrame() should be called.
Definition: PythonModule.C:298
jevois::GUIhelperPython::endFrame
void endFrame()
Finish current frame and render it.
Definition: PythonModule.C:467
LERROR
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
Definition: Log.H:198
jevois::rawimage::convertToCvGray
cv::Mat convertToCvGray(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV gray byte.
Definition: RawImageOps.C:246
jevois::RawImage::invalidate
void invalidate()
Invalidate the image by zero'ing out the pointer to pixel buffer and the dims and format.
Definition: RawImage.C:42
jevois::coords::imgToStdX
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.
Definition: Coordinates.C:36
jevois::RawImage::require
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.
Definition: RawImage.C:77
jevois::OutputFramePython::sendScaledCvRGB1
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.
Definition: PythonModule.C:257
jevois::python::MedGrey
@ MedGrey
Definition: PythonSupport.C:174
jevois::GUIhelperPython::drawText
void drawText(float x, float y, char const *txt, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw text over an image.
Definition: PythonModule.C:424
jevois::python::LightPink
@ LightPink
Definition: PythonSupport.C:177
jevois::getSysInfoVersion
std::string getSysInfoVersion()
Get O.S. version info.
Definition: SysInfo.C:74
jevois::python::DarkTeal
@ DarkTeal
Definition: PythonSupport.C:175
jevois::rawimage::roipaste
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.
Definition: RawImageOps.C:425
jevois::RawImage::width
unsigned int width
Image width in pixels.
Definition: RawImage.H:145
jevois::Timer::stop
const std::string & stop()
Same as the other signature of stop() except does not provide seconds, for python bindings.
Definition: Timer.C:140
jevois::python::LightPurple
@ LightPurple
Definition: PythonSupport.C:176
jevois::GUIhelperPython::releaseImage2
void releaseImage2(char const *name)
Release an image, second video stream.
Definition: PythonModule.C:460
jevois::rawimage::writeText
void writeText(RawImage &img, std::string const &txt, int x, int y, unsigned int col, Font font=Font6x10)
Write some text in an image.
Definition: RawImageOps.C:689
jevois::rawimage::convertCvGRAYtoRawImage
void convertCvGRAYtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a Gray cv::Mat to RawImage with already-allocated pixels and pixel type.
Definition: RawImageOps.C:1359
jevois
Definition: Concepts.dox:1
jevois::getSysInfoCPU
std::string getSysInfoCPU()
Get CPU info: frequency, thermal, load.
Definition: SysInfo.C:24
Engine.H
jevois::GUIhelperPython::startFrame
boost::python::tuple startFrame()
Start a new rendering frame.
Definition: PythonModule.C:289
Log.H
jevois::OutputFramePython::sendCvGRAY1
void sendCvGRAY1(cv::Mat const &img, int quality) const
Shorthand to send a GRAY cv::Mat after converting it to the current output format.
Definition: PythonModule.C:185
jevois::InputFramePython::getCvRGBAp
cv::Mat getCvRGBAp() const
Shorthand to get the input image for processing as a RGBA cv::Mat and release the raw buffer.
Definition: PythonModule.C:149
jevois::system
std::string system(std::string const &cmd, bool errtoo=true)
Execute a command and grab stdout output to a string.
Definition: Utils.C:423
jevois::rawimage::Font8x13bold
@ Font8x13bold
Definition: RawImageOps.H:157
jevois::InputFramePython::getCvBGRp
cv::Mat getCvBGRp() const
Shorthand to get the input image for processing as a BGR cv::Mat and release the raw buffer.
Definition: PythonModule.C:137
jevois::coords::stdToImg
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.
Definition: Coordinates.C:60
jevois::rawimage::Font12x22
@ Font12x22
Definition: RawImageOps.H:161
jevois::python::DarkGreen
@ DarkGreen
Definition: PythonSupport.C:175
jevois::InputFramePython::getCvRGBA1
cv::Mat getCvRGBA1(bool casync) const
Shorthand to get the input image as a RGBA cv::Mat and release the raw buffer.
Definition: PythonModule.C:119
jevois::OutputFramePython::sendCvRGBA
void sendCvRGBA(cv::Mat const &img) const
Shorthand to send a RGBA cv::Mat after converting it to the current output format.
Definition: PythonModule.C:227
jevois::python::White
@ White
Definition: PythonSupport.C:174
jevois::OutputFramePython::sendCvRGB1
void sendCvRGB1(cv::Mat const &img, int quality) const
Shorthand to send a RGB cv::Mat after converting it to the current output format.
Definition: PythonModule.C:209
jevois::InputFramePython::getCvRGBA
cv::Mat getCvRGBA() const
Shorthand to get the input image as a RGBA cv::Mat and release the raw buffer.
Definition: PythonModule.C:125
SysInfo.H
jevois::v4l2BytesPerPix
unsigned int v4l2BytesPerPix(unsigned int fcc)
Return the number of bytes per pixel for a given V4L2_PIX_FMT_...
Definition: Utils.C:137
jevois::GUIhelperPython::reportAndIgnoreException
void reportAndIgnoreException(std::string const &prefix="")
Report current exception in a modal dialog, then ignore it.
Definition: PythonModule.C:481
jevois::python::MedTeal
@ MedTeal
Definition: PythonSupport.C:175
jevois::GUIhelperPython::drawImage
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.
Definition: PythonModule.C:305
jevois::InputFramePython::get2
const RawImage & get2() const
Get the next captured camera image, ISP-scaled second frame.
Definition: PythonModule.C:53
jevois::GUIhelperPython::i2ds1
ImVec2 i2ds1(float x, float y, char const *name=nullptr)
Convert a 2D size from within a rendered image to on-screen.
Definition: PythonModule.C:366
JEVOIS_PYTHON_CONSTANT
#define JEVOIS_PYTHON_CONSTANT(cst)
Definition: PythonSupport.C:56
jevois::rawimage::Font5x7
@ Font5x7
Definition: RawImageOps.H:154
jevois::GUIhelperPython::drawPoly2
void drawPoly2(cv::Mat const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
Definition: PythonModule.C:401
jevois::python::engineForPythonModule
Engine * engineForPythonModule
Definition: PythonSupport.C:65
jevois::InputFramePython::getp1
const RawImage & getp1(bool casync) const
Get the next captured camera image that is intended for processing.
Definition: PythonModule.C:59
Timer.H
jevois::GUIhelperPython::i2d1
ImVec2 i2d1(float x, float y, char const *name=nullptr)
Convert coordinates of a point from within a rendered image to on-screen.
Definition: PythonModule.C:352
jevois::fccstr
std::string fccstr(unsigned int fcc)
Convert a V4L2 four-cc code (V4L2_PIX_FMT_...) to a 4-char string.
Definition: Utils.C:44
Serial.H
jevois::Engine
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
Definition: Engine.H:381
jevois::rawimage::drawFilledRect
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.
Definition: RawImageOps.C:646
Profiler.H
jevois::OutputFramePython::sendScaledCvGRAY1
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.
Definition: PythonModule.C:233
jevois::python::DarkPurple
@ DarkPurple
Definition: PythonSupport.C:176
jevois::OutputFramePython::sendScaledCvRGBA
void sendScaledCvRGBA(cv::Mat const &img) const
Shorthand to send a RGBA cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:275
jevois::rawimage::hFlipYUYV
void hFlipYUYV(RawImage &img)
Flip a YUYV RawImage horizontally while preserving color information.
Definition: RawImageOps.C:1416
jevois::rawimage::convertCvRGBAtoRawImage
void convertCvRGBAtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert an RGBA cv::Mat to RawImage with already-allocated pixels and pixel type.
Definition: RawImageOps.C:1337
LFATAL
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
Definition: Log.H:217
jevois::rawimage::convertCvBGRtoRawImage
void convertCvBGRtoRawImage(cv::Mat const &src, RawImage &dst, int quality)
Convert a BGR cv::Mat to RawImage with already-allocated pixels and pixel type.
Definition: RawImageOps.C:1266
jevois::python::LightTeal
@ LightTeal
Definition: PythonSupport.C:176
jevois::rawimage::unpackCvRGBAtoGrayRawImage
void unpackCvRGBAtoGrayRawImage(cv::Mat const &src, RawImage &dst)
Split an RGBA cv::Mat into a 4x taller grey RawImage with already-allocated pixels.
Definition: RawImageOps.C:1312
jevois::InputFramePython::hasScaledImage
bool hasScaledImage() const
Check whether a second input image scaled by the JeVoisPro Platform ISP is available.
Definition: PythonModule.C:41
JEVOIS_PYTHON_FUNC
#define JEVOIS_PYTHON_FUNC(funcname)
Definition: PythonSupport.C:42
jevois::GUIhelperPython::i2ds
ImVec2 i2ds(ImVec2 p, char const *name=nullptr)
Convert a 2D size from within a rendered image to on-screen.
Definition: PythonModule.C:359
jevois::OutputFramePython::sendScaledCvRGB
void sendScaledCvRGB(cv::Mat const &img) const
Shorthand to send a RGB cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:263
jevois::Engine::imu
std::shared_ptr< IMU > imu() const
Get a pointer to our IMU (may be null)
Definition: Engine.C:1221
jevois::OutputFramePython::sendCvRGB
void sendCvRGB(cv::Mat const &img) const
Shorthand to send a RGB cv::Mat after converting it to the current output format.
Definition: PythonModule.C:215
Camera.H
PythonModule.H
jevois::RawImage::height
unsigned int height
Image height in pixels.
Definition: RawImage.H:146
jevois::Profiler::start
void start()
Start a time measurement period.
Definition: Profiler.C:33
jevois::rawimage::Font16x29
@ Font16x29
Definition: RawImageOps.H:164
jevois::coords::imgToStd
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.
Definition: Coordinates.C:22
jevois::GUIhelperPython::drawRect
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.
Definition: PythonModule.C:380
jevois::RawImage::coordsOk
bool coordsOk(int x, int y) const
Helper function to check that coords are within image bounds.
Definition: RawImage.C:85
jevois::rawimage::Font11x22
@ Font11x22
Definition: RawImageOps.H:160
jevois::OutputFramePython::sendScaledCvBGR1
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.
Definition: PythonModule.C:245
jevois::rawimage::cvImage
cv::Mat cvImage(RawImage const &src)
Create an OpenCV image from the existing RawImage data, sharing the pixel memory rather than copying ...
Definition: RawImageOps.C:31
jevois::GUIhelperPython::releaseImage
void releaseImage(char const *name)
Release an image.
Definition: PythonModule.C:453
jevois::OutputFramePython::sendCvRGBA1
void sendCvRGBA1(cv::Mat const &img, int quality) const
Shorthand to send a RGBA cv::Mat after converting it to the current output format.
Definition: PythonModule.C:221
jevois::OutputFramePython::sendCvBGR
void sendCvBGR(cv::Mat const &img) const
Shorthand to send a BGR cv::Mat after converting it to the current output format.
Definition: PythonModule.C:203
jevois::InputFramePython::done2
void done2() const
Indicate that user processing is done with the ISP-scaled image previously obtained via get2()
Definition: PythonModule.C:77
jevois::InputFramePython::getCvRGB
cv::Mat getCvRGB() const
Shorthand to get the input image as a RGB cv::Mat and release the raw buffer.
Definition: PythonModule.C:113
jevois::python::YUYV
YUYV
Definition: PythonSupport.C:174
JEVOIS_PYTHON_RAWIMAGE_FUNC
#define JEVOIS_PYTHON_RAWIMAGE_FUNC(funcname)
Definition: PythonSupport.C:46
jevois::rawimage::paste
void paste(RawImage const &src, RawImage &dest, int dx, int dy)
Paste an image within another of same pixel type.
Definition: RawImageOps.C:403
jevois::InputFramePython::get21
const RawImage & get21(bool casync) const
Get the next captured camera image, ISP-scaled second frame.
Definition: PythonModule.C:47
jevois::Engine::frameNum
size_t frameNum() const
Get frame number.
Definition: Engine.C:1213
jevois::rawimage::drawRect
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.
Definition: RawImageOps.C:607
jevois::RawImage::fmt
unsigned int fmt
Pixel format as a V4L2_PIX_FMT_XXX.
Definition: RawImage.H:147
Utils.H
jevois::v4l2ImageSize
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.
Definition: Utils.C:161
jevois::InputFramePython::getCvBGR1
cv::Mat getCvBGR1(bool casync) const
Shorthand to get the input image as a BGR cv::Mat and release the raw buffer.
Definition: PythonModule.C:95
imgToStd1
void(* imgToStd1)(float &x, float &y, jevois::RawImage const &camimg, float const eps)
Definition: PythonSupport.C:226
jevois::GUIhelperPython::drawLine
void drawLine(float x1, float y1, float x2, float y2, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw line over an image.
Definition: PythonModule.C:373
PythonOpenCV.H
jevois::Profiler::stop
void stop()
End a time measurement period, report time spent for each checkpoint if reporting interval is reached...
Definition: Profiler.C:74
jevois::rawimage::convertToCvRGBA
cv::Mat convertToCvRGBA(RawImage const &src)
Convert RawImage to OpenCV doing color conversion from any RawImage source pixel to OpenCV RGB-A byte...
Definition: RawImageOps.C:332
h
int h
Definition: GUIhelper.C:2157
jevois::python::Black
@ Black
Definition: PythonSupport.C:174
jevois::GUIhelperPython::drawInputFrame
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.
Definition: PythonModule.C:325
jevois::InputFramePython::getCvBGR
cv::Mat getCvBGR() const
Shorthand to get the input image as a BGR cv::Mat and release the raw buffer.
Definition: PythonModule.C:101
jevois::Engine::sendSerial
void sendSerial(std::string const &str, bool islog=false)
Send a string to all serial ports.
Definition: Engine.C:1120
jevois::GUIhelperPython::i2d
ImVec2 i2d(ImVec2 p, char const *name=nullptr)
Convert coordinates of a point from within a rendered image to on-screen.
Definition: PythonModule.C:345
jevois::rawimage::convertCvBGRtoCvYUYV
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.
Definition: RawImageOps.C:1026
jevois::GUIhelperPython::drawCircle
void drawCircle(float x, float y, float r, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw circle over an image.
Definition: PythonModule.C:417
jevois::rawimage::Font7x13
@ Font7x13
Definition: RawImageOps.H:156
jevois::rawimage::drawLine
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.
Definition: RawImageOps.C:564
jevois::GUIhelperPython::drawInputFrame2
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.
Definition: PythonModule.C:335
jevois::python::MedPink
@ MedPink
Definition: PythonSupport.C:177
jevois::OutputFramePython::sendCv
void sendCv(cv::Mat const &img) const
Shorthand to send a cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:179
jevois::rawimage::Font10x20
@ Font10x20
Definition: RawImageOps.H:159
jevois::strfcc
unsigned int strfcc(std::string const &str)
Convert a JeVois video format string to V4L2 four-cc code (V4L2_PIX_FMT_...)
Definition: Utils.C:110
jevois::InputFramePython::getCvGRAY1
cv::Mat getCvGRAY1(bool casync) const
Shorthand to get the input image as a GRAY cv::Mat and release the raw buffer.
Definition: PythonModule.C:83
jevois::rawimage::pasteGreyToYUYV
void pasteGreyToYUYV(cv::Mat const &src, RawImage &dest, int dx, int dy)
Paste a grey byte image into a YUYV image.
Definition: RawImageOps.C:448
LINFO
#define LINFO(msg)
Convenience macro for users to print out console or syslog messages, INFO level.
Definition: Log.H:181
jevois::rawimage::convertGreyToYUYV
void convertGreyToYUYV(RawImage const &src, RawImage &dst)
Convert from Grey (monochrome) to YUYV, only used internally by Camera class.
Definition: RawImageOps.C:1613
jevois::python::DarkPink
@ DarkPink
Definition: PythonSupport.C:177
IMU.H
jevois::GUIhelperPython::reportAndRethrowException
void reportAndRethrowException(std::string const &prefix="")
Report current exception in a modal dialog, then re-throw it.
Definition: PythonModule.C:488
imgToStd2
void(* imgToStd2)(float &x, float &y, unsigned int const width, unsigned int const height, float const eps)
Definition: PythonSupport.C:227
jevois::rawimage::byteSwap
void byteSwap(RawImage &img)
Swap pairs of bytes in a RawImage.
Definition: RawImageOps.C:368
jevois::rawimage::convertCvGRAYtoCvYUYV
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.
Definition: RawImageOps.C:1184
jevois::GUIhelperPython::reportError
void reportError(std::string const &err)
Report an error in an overlay window.
Definition: PythonModule.C:474
jevois::OutputFramePython::sendCvGRAY
void sendCvGRAY(cv::Mat const &img) const
Shorthand to send a GRAY cv::Mat after converting it to the current output format.
Definition: PythonModule.C:191
jevois::Timer
Simple timer class.
Definition: Timer.H:34
jevois::OutputFramePython::sendScaledCvBGR
void sendScaledCvBGR(cv::Mat const &img) const
Shorthand to send a BGR cv::Mat after scaling/converting it to the current output format.
Definition: PythonModule.C:251
jevois::OutputFramePython::sendCvBGR1
void sendCvBGR1(cv::Mat const &img, int quality) const
Shorthand to send a BGR cv::Mat after converting it to the current output format.
Definition: PythonModule.C:197