JeVoisBase  1.5
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
DemoGPU Class Reference

Simple image filtering demo using OpenGL-ES 2.0 shaders on the Mali-400MP2 GPU. More...

Inheritance diagram for DemoGPU:
Collaboration diagram for DemoGPU:

Public Member Functions

 DemoGPU (std::string const &instance)
 Constrctor. More...
 
virtual ~DemoGPU ()
 Virtual destructor for safe inheritance. More...
 
virtual void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 Processing function. More...
 
void onParamChange (effect const &JEVOIS_UNUSED_PARAM(param), Effect const &newval)
 
- Public Member Functions inherited from jevois::Module
 Module (std::string const &instance)
 
virtual ~Module ()
 
virtual void process (InputFrame &&inframe)
 
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)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerStyle,(Terse)(Normal)(Detail)(Fine)) JEVOIS_DECLARE_PARAMETER(serstyle
 
 JEVOIS_DECLARE_PARAMETER (serprec, unsigned int, "Number of decimal points in standardized serial messages as " "defined in http://jevois.org/doc/UserSerialStyle.html", 0U, ParamCateg)
 
- Public Member Functions inherited from jevois::Component
 Component (std::string const &instance)
 
virtual ~Component ()
 
std::shared_ptr< ComponentgetSubComponent (std::string const &instance) const
 
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 &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string 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 &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string const &path="")
 
- Public Member Functions inherited from jevois::ParameterRegistry
virtual ~ParameterRegistry ()
 

Related Functions

(Note that these are not member functions.)

 JEVOIS_DEFINE_ENUM_CLASS (Effect,(NoEffect)(Blur)(Sobel)(Median)(Mult)(Thresh)(Dilate)(Erode)(Twirl)(Dewarp))
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK (effect, Effect, "GPU image processing effect to apply", Effect::Twirl, Effect_Values, ParamCateg)
 Parameter. More...
 

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 ()
 

Detailed Description

Simple image filtering demo using OpenGL-ES 2.0 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.

Using this module

Unfortunately, Mac OSX 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, and the module is disabled by default. In addition, RGB565 does not seem to work in 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
Author
Laurent Itti
Display Name:
Demo GPU
Videomapping:
RGB565 320 240 22.0 YUYV 320 240 22.0 JeVois DemoGPU
Email:
itti@usc.edu
Address:
University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA
Main URL:
http://jevois.org
Support URL:
http://jevois.org/doc
Other URL:
http://iLab.usc.edu
License:
GPL v3
Distribution:
Unrestricted
Restrictions:
None

Definition at line 98 of file DemoGPU.C.

Constructor & Destructor Documentation

◆ DemoGPU()

DemoGPU::DemoGPU ( std::string const &  instance)
inline

Constrctor.

Definition at line 103 of file DemoGPU.C.

◆ ~DemoGPU()

virtual DemoGPU::~DemoGPU ( )
inlinevirtual

Virtual destructor for safe inheritance.

Definition at line 109 of file DemoGPU.C.

Member Function Documentation

◆ onParamChange()

void DemoGPU::onParamChange ( effect const &  JEVOIS_UNUSED_PARAMparam,
Effect const &  newval 
)
inline

Definition at line 147 of file DemoGPU.C.

References JEVOIS_REGISTER_MODULE().

◆ process()

virtual void DemoGPU::process ( jevois::InputFrame &&  inframe,
jevois::OutputFrame &&  outframe 
)
inlineoverridevirtual

Friends And Related Function Documentation

◆ JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK()

JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK ( effect  ,
Effect  ,
"GPU image processing effect to apply"  ,
Effect::Twirl  ,
Effect_Values  ,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DEFINE_ENUM_CLASS()

JEVOIS_DEFINE_ENUM_CLASS ( Effect  ,
(NoEffect)(Blur)(Sobel)(Median)(Mult)(Thresh)(Dilate)(Erode)(Twirl)(Dewarp)   
)
related

Parameter.


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