JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Simple image filtering demo using OpenGL-ES shaders on the Mali-400MP2 GPU. More...
Public Member Functions | |
DemoGPU (std::string const &instance) | |
Constrctor. | |
virtual | ~DemoGPU () |
Virtual destructor for safe inheritance. | |
virtual void | process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override |
Processing function. | |
void | onParamChange (effect const &JEVOIS_UNUSED_PARAM(param), Effect const &newval) override |
Public Member Functions inherited from jevois::Module | |
Module (std::string const &instance) | |
virtual | ~Module () |
virtual void | process (InputFrame &&inframe) |
virtual void | process (InputFrame &&inframe, GUIhelper &helper) |
virtual void | sendSerial (std::string const &str) |
virtual void | parseSerial (std::string const &str, std::shared_ptr< UserInterface > s) |
virtual void | supportedCommands (std::ostream &os) |
Public Member Functions inherited from jevois::Component | |
Component (std::string const &instance) | |
virtual | ~Component () |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
Public Member Functions inherited from jevois::ParameterRegistry | |
virtual | ~ParameterRegistry () |
Related Symbols | |
(Note that these are not member symbols.) | |
JEVOIS_DEFINE_ENUM_CLASS (Effect,(NoEffect)(Blur)(Sobel)(Median)(Mult)(Thresh)(Dilate)(Erode)(Twirl)(Dewarp)) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK (effect, Effect, "GPU image processing effect to apply", Effect::Twirl, Effect_Values, ParamCateg) | |
Parameter. | |
Additional Inherited Members | |
Protected Member Functions inherited from jevois::Component | |
virtual void | preInit () |
virtual void | postInit () |
virtual void | preUninit () |
virtual void | postUninit () |
virtual void | preInit () |
virtual void | postInit () |
virtual void | preUninit () |
virtual void | postUninit () |
Protected Member Functions inherited from jevois::ParameterRegistry | |
void | addParameter (ParameterBase *const param) |
void | removeParameter (ParameterBase *const param) |
void | callbackInitCall () |
Simple image filtering demo using OpenGL-ES shaders on the Mali-400MP2 GPU.
This class first copies the given input image into an OpenGL texture, then applies OpenGL-ES vertex and fragment shaders to achieve some image processing, and finally gets the resulting pixels back into an image.
This code is inspired somewhat from the tutorial and code examples found on this page: http://robotblogging.blogspot.com/2013/10/gpu-accelerated-camera-processing-on.html
But an important distinction is that we render to a framebuffer with an RGB565 renderbuffer attached, which accelerates processing and transfer of the results a lot.
Dewarp algorithm contributed by JeVois user Ali AlSaibie. It is to be used with a modified JeVois camera sensor that has a wide-angle lens. See http://jevois.org/qa/index.php?qa=153 for details.
Unfortunately, MacOS computers refuse to detect the JeVois smart camera as soon as it exposes one or more RGB565 video modes. Thus, you cannot use this module with Macs in its native version (but see below), and the module is disabled by default. In addition, RGB565 does not seem to work in older guvcview
either, on Ubuntu prior to 17.04! Proceed as follows to enable and use this module on a Linux host:
Edit JEVOIS:/jevois/config/videomappings.cfg and look for the line that mentions DemoGPU. It is commented out, so just remove the leading # sign. The line should then look like this:
RGB565 320 240 22.0 YUYV 320 240 22.0 JeVois DemoGPU
Restart JeVois and run this on your Linux host if older than Ubuntu 17.04:
sudo apt install ffmpeg ffplay /dev/video0 -pixel_format rgb565 -video_size 320x240
or, with Ubuntu 17.04 and later:
guvcview -f RGBP -x 320x240
This module can also work with YUYV output, which is then compatible with MacOS, JeVois Inventor, etc. But note that the conversion from RGB565 to YUYV consumes some CPU on the JeVois camera.
|
inline |
|
inlinevirtual |
|
inlineoverride |
Definition at line 170 of file DemoGPU.C.
References JEVOIS_UNUSED_PARAM.
|
inlineoverridevirtual |
Processing function.
Reimplemented from jevois::Module.
Definition at line 118 of file DemoGPU.C.
References jevois::rawimage::convertCvBGRtoRawImage(), jevois::rawimage::convertToCvRGBA(), jevois::rawimage::cvImage(), jevois::RawImage::fmt, jevois::RawImage::height, LFATAL, jevois::Timer::start(), jevois::Timer::stop(), jevois::rgb565::White, jevois::yuyv::White, jevois::RawImage::width, and jevois::rawimage::writeText().
|
related |
Parameter.
|
related |
Parameter.