JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches

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

Constructor & Destructor Documentation

◆ GUIhelperPython()

jevois::GUIhelperPython::GUIhelperPython ( GUIhelper src)

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

Definition at line 249 of file PythonModule.C.

References LFATAL.

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 349 of file PythonModule.C.

◆ 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 355 of file PythonModule.C.

◆ 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 361 of file PythonModule.C.

◆ 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 367 of file PythonModule.C.

◆ 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 403 of file PythonModule.C.

◆ drawEllipse()

void jevois::GUIhelperPython::drawEllipse ( float  x,
float  y,
float  rx,
float  ry,
float  rot = 0.0F,
ImU32  col = IM_COL32(128,255,128,255),
bool  filled = true 
)

Draw ellipse over an image.

Definition at line 409 of file PythonModule.C.

◆ 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 267 of file PythonModule.C.

References h.

◆ 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 276 of file PythonModule.C.

References h.

◆ 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 285 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 296 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 307 of file PythonModule.C.

References h.

◆ 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 316 of file PythonModule.C.

References h.

◆ 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 373 of file PythonModule.C.

◆ 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 385 of file PythonModule.C.

◆ 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 391 of file PythonModule.C.

◆ 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 397 of file PythonModule.C.

◆ 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 379 of file PythonModule.C.

◆ 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 415 of file PythonModule.C.

◆ endFrame()

void jevois::GUIhelperPython::endFrame ( )

Finish current frame and render it.

Definition at line 458 of file PythonModule.C.

◆ frameStarted()

bool jevois::GUIhelperPython::frameStarted ( ) const

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

Definition at line 261 of file PythonModule.C.

◆ getMousePos()

ImVec2 jevois::GUIhelperPython::getMousePos ( )

ImGui helper: get mouse position.

Definition at line 482 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 325 of file PythonModule.C.

◆ 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 331 of file PythonModule.C.

◆ 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 337 of file PythonModule.C.

◆ 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 343 of file PythonModule.C.

◆ 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 439 of file PythonModule.C.

◆ 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 421 of file PythonModule.C.

◆ isMouseClicked()

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

ImGui helper: check if mouse button clicked.

Definition at line 486 of file PythonModule.C.

◆ isMouseDoubleClicked()

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

ImGui helper: check if mouse button double-clicked.

Definition at line 490 of file PythonModule.C.

◆ isMouseDown()

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

ImGui helper: check if mouse button pressed.

Definition at line 498 of file PythonModule.C.

◆ isMouseDragging()

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

ImGui helper: check if mouse button dragged.

Definition at line 494 of file PythonModule.C.

◆ isMouseReleased()

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

ImGui helper: check if mouse button released.

Definition at line 502 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 427 of file PythonModule.C.

◆ itext2()

void jevois::GUIhelperPython::itext2 ( char const *  txt)

Draw some overlay text on top of an image, default color and line.

Definition at line 433 of file PythonModule.C.

◆ releaseImage()

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

Release an image.

Definition at line 446 of file PythonModule.C.

◆ releaseImage2()

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

Release an image, second video stream.

Definition at line 452 of file PythonModule.C.

◆ reportAndIgnoreException()

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

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

Definition at line 470 of file PythonModule.C.

◆ reportAndRethrowException()

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

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

Definition at line 476 of file PythonModule.C.

◆ reportError()

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

Report an error in an overlay window.

Definition at line 464 of file PythonModule.C.

◆ startFrame()

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

Start a new rendering frame.

Definition at line 253 of file PythonModule.C.

References h.


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