JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
43 #include <glm/glm.hpp>
44 #include <opencv2/core/core.hpp>
57 "Platform always is fullscreen as the MALI OpenGL driver do not support windowing.",
62 "by hardware and the value of this parameter will be overwritten on init. The "
63 "parameter can still be used to query display size.",
64 #ifdef JEVOIS_PLATFORM
76 "which we hide the GUI, or 0.0 to never hide it. Note: The GUI starts hidden until the "
77 "first input event from a keyboard, mouse, etc.",
82 2.0f, { 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f,
83 2.1f, 2.2f, 2.3f, 2.4f, 2.5f, 2.6f, 2.7f, 2.8f, 2.9f, 3.0f },
91 GuiStyle::Light, GuiStyle_Values, ParamCateg);
95 "Note than changing GUI scale will update this parameter as well.",
100 ImColor(255, 255, 255, 255), ParamCateg);
116 "mainly for demo mode",
129 public Parameter<gui::fullscreen, gui::winsize, gui::hidesecs, gui::scale,
130 gui::style, gui::rounding, gui::overlaycolor, gui::linethick,
131 gui::fillalpha, gui::allowquit, gui::twirl>
135 GUIhelper(std::string
const & instance,
bool conslock =
false);
144 bool startFrame(
unsigned short & w,
unsigned short &
h);
167 void drawImage(
char const * name,
RawImage const & img,
int & x,
int & y,
unsigned short & w,
unsigned short &
h,
168 bool noalias =
false,
bool isoverlay =
false);
181 void drawImage(
char const * name, cv::Mat
const & img,
bool rgb,
int & x,
int & y,
unsigned short & w,
182 unsigned short &
h,
bool noalias =
false,
bool isoverlay =
false);
189 unsigned short & w,
unsigned short &
h,
bool noalias =
false,
bool casync =
false);
197 unsigned short & w,
unsigned short &
h,
bool noalias =
false,
bool casync =
false);
204 ImVec2
i2d(ImVec2 p,
char const * name =
nullptr);
211 ImVec2
i2d(
float x,
float y,
char const * name =
nullptr);
218 ImVec2
i2ds(ImVec2 p,
char const * name =
nullptr);
225 ImVec2
i2ds(
float x,
float y,
char const * name =
nullptr);
229 void drawLine(
float x1,
float y1,
float x2,
float y2, ImU32 col = IM_COL32(128,255,128,255));
233 void drawRect(
float x1,
float y1,
float x2,
float y2, ImU32 col = IM_COL32(128,255,128,255),
bool filled =
true);
237 void drawPoly(std::vector<cv::Point>
const & pts, ImU32 col = IM_COL32(128,255,128,255),
bool filled =
true);
241 void drawPoly(std::vector<cv::Point2f>
const & pts, ImU32 col = IM_COL32(128,255,128,255),
bool filled =
true);
245 void drawCircle(
float x,
float y,
float r, ImU32 col = IM_COL32(128,255,128,255),
bool filled =
true);
249 void drawText(
float x,
float y,
char const * txt, ImU32 col = IM_COL32(128,255,128,255));
253 void drawText(
float x,
float y, std::string
const & txt, ImU32 col = IM_COL32(128,255,128,255));
259 ImVec2
iline(
int line = -1,
char const * name =
nullptr);
264 void itext(
char const * txt, ImU32
const & col = IM_COL32_BLACK_TRANS,
int line = -1);
269 void itext(std::string
const & txt, ImU32
const & col = IM_COL32_BLACK_TRANS,
int line = -1);
277 unsigned short winw = 0,
unsigned short winh = 0);
299 void reset(
bool modulechanged =
true);
330 void helpMarker(
char const * msg,
char const * msg2 =
nullptr,
char const * msg3 =
nullptr);
340 int modal(std::string
const & title,
char const * text,
int * default_val =
nullptr,
341 char const * b1txt =
"Ok",
char const * b2txt =
"Cancel");
357 ImVec2
d2i(ImVec2 p,
char const * name =
nullptr);
364 ImVec2
d2i(
float x,
float y,
char const * name =
nullptr);
371 ImVec2
d2is(ImVec2 p,
char const * name =
nullptr);
378 ImVec2
d2is(
float x,
float y,
char const * name =
nullptr);
390 void demoBanner(std::string
const & title =
"", std::string
const & msg =
"");
408 std::chrono::time_point<std::chrono::steady_clock>
firsttime;
409 std::chrono::time_point<std::chrono::steady_clock>
lasttime;
415 void drawPolyInternal(ImVec2
const * pts,
size_t npts, ImU32 col,
bool filled);
419 #ifdef JEVOIS_PLATFORM_PRO
452 void newModEntry(
char const * wname, std::string & str,
char const * desc,
char const * hint,
char const * hlp);
461 void onParamChange(gui::scale
const & param,
float const & newval)
override;
462 void onParamChange(gui::rounding
const & param,
int const & newval)
override;
463 void onParamChange(gui::style
const & param, gui::GuiStyle
const & newval)
override;
464 void onParamChange(gui::twirl
const & param,
float const & newval)
override;
499 #include <jevois/GPU/details/GUIhelperImpl.H>
std::string descriptor() const
Get our full descriptor (including all parents) as [Instancename]:[...]:[...].
std::shared_ptr< GUIeditor > itsCodeEditor
void drawImage(char const *name, RawImage const &img, int &x, int &y, unsigned short &w, unsigned short &h, bool noalias=false, bool isoverlay=false)
Draw a RawImage, copying pixel data to an OpenGL texture.
void highlightText(std::string const &str)
Like ImGui::Textunformatted but in a highlight color (typically, red)
void drawInputFrame2(char const *name, InputFrame const &frame, int &x, int &y, unsigned short &w, unsigned short &h, bool noalias=false, bool casync=false)
Draw the second (scaled) input video frame from the camera using zero-copy.
bool idle() const
Check for idle in case startFrame() was called elsewhere.
void reportAndIgnoreException(std::string const &prefix="")
Report current exception in a modal dialog, then ignore it.
void demoBanner(std::string const &title="", std::string const &msg="")
Display some text in a big banner, used by demo mode.
void drawCircle(float x, float y, float r, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw circle over an image.
std::map< std::string, GPUimage > itsImages2
bool startFrame(unsigned short &w, unsigned short &h)
Start a new rendering frame.
int modal(std::string const &title, char const *text, int *default_val=nullptr, char const *b1txt="Ok", char const *b2txt="Cancel")
Helper to draw a modal with 2 choices.
bool compileCommand(std::string const &cmd, std::string &msg)
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 onParamChange(gui::scale const ¶m, float const &newval) override
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
void setparstr(std::string const &descriptor, std::string const &val)
Class to hold a GPUtexture, GPUprogram, and other data associated with rendering an image in OpenGL.
void headlessDisplay()
Show a message that we are running headless.
void drawPolyInternal(ImVec2 const *pts, size_t npts, ImU32 col, bool filled)
void endFrame()
Finish current frame and render it.
A component of a model hierarchy.
std::set< std::string > itsOpenModals
void reportAndRethrowException(std::string const &prefix="")
Report current exception in a modal dialog, then re-throw it.
void releaseImage(char const *name)
Release an image.
bool itsIdle
Idle state, updated by startFrame(), used by endFrame() to decide whether to draw GUI.
std::list< ErrorData > itsErrors
void newModEntry(char const *wname, std::string &str, char const *desc, char const *hint, char const *hlp)
Wrapper for an image that can be rendered into ImGui.
void clearErrors()
Clear all errors currently displayed in the JeVois-Pro GUI.
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
ImVec2 d2i(ImVec2 p, char const *name=nullptr)
Convert coordinates of a point from on-screen to within a rendered image.
void helpMarker(char const *msg, char const *msg2=nullptr, char const *msg3=nullptr)
Display a (?) label and show tooltip when it is hovered.
ImVec2 i2d(ImVec2 p, char const *name=nullptr)
Convert coordinates of a point from within a rendered image to on-screen.
bool itsRefreshVideoMappings
A category to which multiple ParameterDef definitions can belong.
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.
std::future< std::string > itsDnnGetFut
gui::GuiStyle itsCurrentStyle
Helper class to assist modules in creating graphical and GUI elements.
GPUimage * itsLastDrawnImage
void drawLine(float x1, float y1, float x2, float y2, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw line over an image.
bool seroutEnabled() const
Tell whether user enabled serout messages to GUI console.
std::chrono::time_point< std::chrono::steady_clock > itsLastEventTime
std::map< std::string, GPUimage > itsImages
glm::mat4 proj
Our projection matrix.
void reportError(std::string const &err)
Report an error in an overlay window.
std::chrono::time_point< std::chrono::steady_clock > lasttime
ImGuiBackendMALI itsBackend
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(l2grad, bool, "Use more accurate L2 gradient norm if true, L1 if false", false, ParamCateg)
void drawPoly(std::vector< cv::Point > const &pts, ImU32 col=IM_COL32(128, 255, 128, 255), bool filled=true)
Draw polygon over an image.
VideoMapping itsNewMapping
bool toggleButton(char const *name, bool *val)
Helper to draw a toggle button.
void reset(bool modulechanged=true)
Reset to default state, typically called on Module or video format change.
bool frameStarted() const
Helper to indicate that startFrame() was called, and thus endFrame() should be called.
bool itsIdleBlocked
While creating/compiling new modules, prevent idle.
bool serlogEnabled() const
Tell whether user enabled serlog messages to GUI console.
void releaseImage2(char const *name)
Release an image, second video stream.
std::vector< std::string > itsModDoc
void drawText(float x, float y, char const *txt, ImU32 col=IM_COL32(128, 255, 128, 255))
Draw text over an image.
std::future< std::string > itsCompileFut
GUIhelper(std::string const &instance, bool conslock=false)
Constructor.
glm::mat4 view
Our view matrix.
void drawInputFrame(char const *name, InputFrame const &frame, int &x, int &y, unsigned short &w, unsigned short &h, bool noalias=false, bool casync=false)
Draw the input video frame from the camera using zero-copy.
std::array< std::string, 4 > itsCompileMessages
void iinfo(jevois::InputFrame const &inframe, std::string const &fpscpu, unsigned short winw=0, unsigned short winh=0)
Display processing and video info at bottom of screen.
BackendMALI for ImGui on JeVois-Pro.
std::string itsWindowTitle
ImVec2 d2is(ImVec2 p, char const *name=nullptr)
Convert a 2D size from on-screen to within a rendered image.
std::shared_ptr< GUIeditor > itsCfgEditor
ImVec2 i2ds(ImVec2 p, char const *name=nullptr)
Convert a 2D size from within a rendered image to on-screen.
CompilationState itsCompileState
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.
int itsVideoMappingListType
JEVOIS_DEFINE_ENUM_CLASS(CameraSensor,(any)(imx290)(os08a10)(ar0234))
Enum for different sensor models.
void startCompilation()
Compile a newly created module.
const float pixel_perfect_z
Z distance from camera to image plane to achieve pixel-perfect rendering.
std::string itsBannerTitle
ImU32 applyFillAlpha(ImU32 col) const
virtual ~GUIhelper()
Destructor.
void setparval(std::string const &descriptor, T const &val)
std::chrono::time_point< std::chrono::steady_clock > firsttime