JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:

#include <jevois/Core/PythonModule.H>

Wrapper around GUIhelper to be used by Python.

This class is not intended for general use, but only for use by PythonModule. Users of this class must ensure that the original GUIhelper will outlive any and all GUIhelperPython instances, since GUIhelperPython just references to the source GUIhelper by unprotected raw pointer. Although the C++ object is called GUIhelperPython, we will expose it to python under the name GUIhelper (see PythonSupport.C).

Definition at line 224 of file PythonModule.H.

Public Member Functions

 GUIhelperPython (GUIhelper *src)
 Construct from a regular GUIhelper that should be be coming from Engine. More...
 
boost::python::tuple startFrame ()
 Start a new rendering frame. More...
 
bool frameStarted () const
 Helper to indicate that startFrame() was called, and thus endFrame() should be called. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
ImVec2 i2d (ImVec2 p, char const *name=nullptr)
 Convert coordinates of a point from within a rendered image to on-screen. More...
 
ImVec2 i2d1 (float x, float y, char const *name=nullptr)
 Convert coordinates of a point from within a rendered image to on-screen. More...
 
ImVec2 i2ds (ImVec2 p, char const *name=nullptr)
 Convert a 2D size from within a rendered image to on-screen. More...
 
ImVec2 i2ds1 (float x, float y, char const *name=nullptr)
 Convert a 2D size from within a rendered image to on-screen. More...
 
void drawLine (float x1, float y1, float x2, float y2, ImU32 col=IM_COL32(128, 255, 128, 255))
 Draw line over an image. More...
 
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. More...
 
void drawPoly (std::vector< cv::Point > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
 Draw polygon over an image. More...
 
void drawPoly1 (std::vector< cv::Point2f > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
 Draw polygon over an image. More...
 
void drawPoly2 (cv::Mat const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
 Draw polygon over an image. More...
 
void drawCircle (float x, float y, float r, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
 Draw circle over an image. More...
 
void drawText (float x, float y, char const *txt, ImU32 col=IM_COL32(128, 255, 128, 255))
 Draw text over an image. More...
 
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. More...
 
void itext (char const *txt, ImU32 const &col=IM_COL32_BLACK_TRANS, int line=-1)
 Draw some overlay text on top of an image. More...
 
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. More...
 
void releaseImage (char const *name)
 Release an image. More...
 
void releaseImage2 (char const *name)
 Release an image, second video stream. More...
 
void endFrame ()
 Finish current frame and render it. More...
 
ImVec2 d2i (ImVec2 p, char const *name=nullptr)
 Convert coordinates of a point from on-screen to within a rendered image. More...
 
ImVec2 d2i1 (float x, float y, char const *name=nullptr)
 Convert coordinates of a point from on-screen to within a rendered image. More...
 
ImVec2 d2is (ImVec2 p, char const *name=nullptr)
 Convert a 2D size from on-screen to within a rendered image. More...
 
ImVec2 d2is1 (float x, float y, char const *name=nullptr)
 Convert a 2D size from on-screen to within a rendered image. More...
 
void reportError (std::string const &err)
 Report an error in an overlay window. More...
 
void reportAndIgnoreException (std::string const &prefix="")
 Report current exception in a modal dialog, then ignore it. More...
 
void reportAndRethrowException (std::string const &prefix="")
 Report current exception in a modal dialog, then re-throw it. More...
 
ImVec2 getMousePos ()
 ImGui helper: get mouse position. More...
 
bool isMouseClicked (int button_num)
 ImGui helper: check if mouse button clicked. More...
 
bool isMouseDoubleClicked (int button_num)
 ImGui helper: check if mouse button double-clicked. More...
 
bool isMouseDragging (int button_num)
 ImGui helper: check if mouse button dragged. More...
 
bool isMouseDown (int button_num)
 ImGui helper: check if mouse button pressed. More...
 
bool isMouseReleased (int button_num)
 ImGui helper: check if mouse button released. More...
 

Constructor & Destructor Documentation

◆ GUIhelperPython()

jevois::GUIhelperPython::GUIhelperPython ( GUIhelper src)

Construct from a regular GUIhelper that should be be coming from Engine.

Definition at line 290 of file PythonModule.C.

Member Function Documentation

◆ d2i()

ImVec2 jevois::GUIhelperPython::d2i ( ImVec2  p,
char const *  name = nullptr 
)

Convert coordinates of a point from on-screen to within a rendered image.

Definition at line 402 of file PythonModule.C.

References LFATAL.

◆ d2i1()

ImVec2 jevois::GUIhelperPython::d2i1 ( float  x,
float  y,
char const *  name = nullptr 
)

Convert coordinates of a point from on-screen to within a rendered image.

Definition at line 409 of file PythonModule.C.

References LFATAL.

◆ d2is()

ImVec2 jevois::GUIhelperPython::d2is ( ImVec2  p,
char const *  name = nullptr 
)

Convert a 2D size from on-screen to within a rendered image.

Definition at line 416 of file PythonModule.C.

References LFATAL.

◆ d2is1()

ImVec2 jevois::GUIhelperPython::d2is1 ( float  x,
float  y,
char const *  name = nullptr 
)

Convert a 2D size from on-screen to within a rendered image.

Definition at line 423 of file PythonModule.C.

References LFATAL.

◆ drawCircle()

void jevois::GUIhelperPython::drawCircle ( float  x,
float  y,
float  r,
ImU32  col = IM_COL32(128,255,128,255),
bool  filled = true 
)

Draw circle over an image.

Definition at line 482 of file PythonModule.C.

References LFATAL.

◆ drawImage()

boost::python::tuple jevois::GUIhelperPython::drawImage ( char const *  name,
RawImage const &  img,
bool  noalias = false,
bool  isoverlay = false 
)

Draw a RawImage, copying pixel data to an OpenGL texture.

Definition at line 310 of file PythonModule.C.

References h, and LFATAL.

◆ drawImage1()

boost::python::tuple jevois::GUIhelperPython::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 at line 320 of file PythonModule.C.

References h, and LFATAL.

◆ drawImage2()

boost::python::tuple jevois::GUIhelperPython::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.

Definition at line 330 of file PythonModule.C.

References h, and LFATAL.

◆ drawImage3()

boost::python::tuple jevois::GUIhelperPython::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.

Definition at line 342 of file PythonModule.C.

References h, and LFATAL.

◆ drawInputFrame()

boost::python::tuple jevois::GUIhelperPython::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 at line 354 of file PythonModule.C.

References h, and LFATAL.

◆ drawInputFrame2()

boost::python::tuple jevois::GUIhelperPython::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 at line 364 of file PythonModule.C.

References h, and LFATAL.

◆ drawLine()

void jevois::GUIhelperPython::drawLine ( float  x1,
float  y1,
float  x2,
float  y2,
ImU32  col = IM_COL32(128,255,128,255) 
)

Draw line over an image.

Definition at line 430 of file PythonModule.C.

References LFATAL.

◆ drawPoly()

void jevois::GUIhelperPython::drawPoly ( std::vector< cv::Point > const &  pts,
ImU32  col = IM_COL32(128,255,128,255),
bool  filled = true 
)

Draw polygon over an image.

Definition at line 444 of file PythonModule.C.

References LFATAL.

◆ drawPoly1()

void jevois::GUIhelperPython::drawPoly1 ( std::vector< cv::Point2f > const &  pts,
ImU32  col = IM_COL32(128,255,128,255),
bool  filled = true 
)

Draw polygon over an image.

Definition at line 451 of file PythonModule.C.

References LFATAL.

◆ drawPoly2()

void jevois::GUIhelperPython::drawPoly2 ( cv::Mat const &  pts,
ImU32  col = IM_COL32(128,255,128,255),
bool  filled = true 
)

Draw polygon over an image.

Definition at line 458 of file PythonModule.C.

References LFATAL, and jevois::dnn::shapestr().

◆ drawRect()

void jevois::GUIhelperPython::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 at line 437 of file PythonModule.C.

References LFATAL.

◆ drawText()

void jevois::GUIhelperPython::drawText ( float  x,
float  y,
char const *  txt,
ImU32  col = IM_COL32(128,255,128,255) 
)

Draw text over an image.

Definition at line 489 of file PythonModule.C.

References LFATAL.

◆ endFrame()

void jevois::GUIhelperPython::endFrame ( )

Finish current frame and render it.

Definition at line 532 of file PythonModule.C.

References LFATAL.

◆ frameStarted()

bool jevois::GUIhelperPython::frameStarted ( ) const

Helper to indicate that startFrame() was called, and thus endFrame() should be called.

Definition at line 303 of file PythonModule.C.

References LFATAL.

◆ getMousePos()

ImVec2 jevois::GUIhelperPython::getMousePos ( )

ImGui helper: get mouse position.

Definition at line 560 of file PythonModule.C.

◆ i2d()

ImVec2 jevois::GUIhelperPython::i2d ( ImVec2  p,
char const *  name = nullptr 
)

Convert coordinates of a point from within a rendered image to on-screen.

Definition at line 374 of file PythonModule.C.

References LFATAL.

◆ i2d1()

ImVec2 jevois::GUIhelperPython::i2d1 ( float  x,
float  y,
char const *  name = nullptr 
)

Convert coordinates of a point from within a rendered image to on-screen.

Definition at line 381 of file PythonModule.C.

References LFATAL.

◆ i2ds()

ImVec2 jevois::GUIhelperPython::i2ds ( ImVec2  p,
char const *  name = nullptr 
)

Convert a 2D size from within a rendered image to on-screen.

Definition at line 388 of file PythonModule.C.

References LFATAL.

◆ i2ds1()

ImVec2 jevois::GUIhelperPython::i2ds1 ( float  x,
float  y,
char const *  name = nullptr 
)

Convert a 2D size from within a rendered image to on-screen.

Definition at line 395 of file PythonModule.C.

References LFATAL.

◆ iinfo()

void jevois::GUIhelperPython::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 at line 510 of file PythonModule.C.

References LFATAL.

◆ iline()

ImVec2 jevois::GUIhelperPython::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 at line 496 of file PythonModule.C.

References LFATAL.

◆ isMouseClicked()

bool jevois::GUIhelperPython::isMouseClicked ( int  button_num)

ImGui helper: check if mouse button clicked.

Definition at line 564 of file PythonModule.C.

◆ isMouseDoubleClicked()

bool jevois::GUIhelperPython::isMouseDoubleClicked ( int  button_num)

ImGui helper: check if mouse button double-clicked.

Definition at line 568 of file PythonModule.C.

◆ isMouseDown()

bool jevois::GUIhelperPython::isMouseDown ( int  button_num)

ImGui helper: check if mouse button pressed.

Definition at line 576 of file PythonModule.C.

◆ isMouseDragging()

bool jevois::GUIhelperPython::isMouseDragging ( int  button_num)

ImGui helper: check if mouse button dragged.

Definition at line 572 of file PythonModule.C.

◆ isMouseReleased()

bool jevois::GUIhelperPython::isMouseReleased ( int  button_num)

ImGui helper: check if mouse button released.

Definition at line 580 of file PythonModule.C.

◆ itext()

void jevois::GUIhelperPython::itext ( char const *  txt,
ImU32 const &  col = IM_COL32_BLACK_TRANS,
int  line = -1 
)

Draw some overlay text on top of an image.

Definition at line 503 of file PythonModule.C.

References LFATAL.

◆ releaseImage()

void jevois::GUIhelperPython::releaseImage ( char const *  name)

Release an image.

Definition at line 518 of file PythonModule.C.

References LFATAL.

◆ releaseImage2()

void jevois::GUIhelperPython::releaseImage2 ( char const *  name)

Release an image, second video stream.

Definition at line 525 of file PythonModule.C.

References LFATAL.

◆ reportAndIgnoreException()

void jevois::GUIhelperPython::reportAndIgnoreException ( std::string const &  prefix = "")

Report current exception in a modal dialog, then ignore it.

Definition at line 546 of file PythonModule.C.

References LFATAL.

◆ reportAndRethrowException()

void jevois::GUIhelperPython::reportAndRethrowException ( std::string const &  prefix = "")

Report current exception in a modal dialog, then re-throw it.

Definition at line 553 of file PythonModule.C.

References LFATAL.

◆ reportError()

void jevois::GUIhelperPython::reportError ( std::string const &  err)

Report an error in an overlay window.

Definition at line 539 of file PythonModule.C.

References LFATAL.

◆ startFrame()

boost::python::tuple jevois::GUIhelperPython::startFrame ( )

Start a new rendering frame.

Definition at line 294 of file PythonModule.C.

References h, and LFATAL.


The documentation for this class was generated from the following files: