JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
SaveVideo Class Reference

Save captured camera frames into a video file. More...

Inheritance diagram for SaveVideo:
Collaboration diagram for SaveVideo:

Public Member Functions

 SaveVideo (std::string const &instance)
 Constructor. More...
 
void postInit () override
 Get started. More...
 
void postUninit () override
 Get stopped. More...
 
virtual ~SaveVideo ()
 Virtual destructor for safe inheritance. More...
 
void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 Processing function, version that also shows a debug video output. More...
 
void process (jevois::InputFrame &&inframe) override
 Processing function, version with no video output. More...
 
void parseSerial (std::string const &str, std::shared_ptr< jevois::UserInterface > s) override
 Receive a string from a serial port which contains a user command. More...
 
void supportedCommands (std::ostream &os) override
 Human-readable description of this Module's supported custom commands. More...
 
- Public Member Functions inherited from jevois::Module
 Module (std::string const &instance)
 
virtual ~Module ()
 
virtual void sendSerial (std::string const &str)
 
- 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 ()
 

Protected Member Functions

void run ()
 
- Protected Member Functions inherited from jevois::Component
virtual void preInit ()
 
virtual void preUninit ()
 
virtual void preInit ()
 
virtual void preUninit ()
 
- Protected Member Functions inherited from jevois::ParameterRegistry
void addParameter (ParameterBase *const param)
 
void removeParameter (ParameterBase *const param)
 
void callbackInitCall ()
 

Protected Attributes

std::future< void > itsRunFut
 
jevois::BoundedBuffer< cv::Mat, jevois::BlockingBehavior::Block, jevois::BlockingBehavior::BlockitsBuf
 
std::atomic< bool > itsSaving
 
int itsFileNum
 
std::atomic< bool > itsRunning
 
std::string itsFilename
 

Related Functions

(Note that these are not member functions.)

#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 
#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 
#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 

Detailed Description

Save captured camera frames into a video file.

Issue the command "start" to start saving video frames, and "stop" to stop saving. Successive start/stop commands will increment the file number (d argument in the 'filename' parameter. Before a file is written, we check whether it already exists, and skip over it by incrementing the file number if so.

This module works with any video resolution and pixel format supported by the camera sensor. Additional video mappings are possible beyond the ones listed here.

When using with no USB output (NONE output format), you should first issue a 'streamon' command to start video streaming, then 'start'. The 'streamon' is not necessary when using with a USB video output, the host computer over USB triggers video streaming when it starts grabbing frames from the JeVois camera.

Author
Laurent Itti
Videomapping:
YUYV 320 240 60.0 YUYV 320 240 60.0 JeVois SaveVideo
Videomapping:
YUYV 320 240 30.0 YUYV 320 240 30.0 JeVois SaveVideo
Videomapping:
NONE 0 0 0 YUYV 320 240 60.0 JeVois SaveVideo
Videomapping:
NONE 0 0 0 YUYV 320 240 30.0 JeVois SaveVideo
Videomapping:
NONE 0 0 0 YUYV 176 144 120.0 JeVois SaveVideo
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 87 of file SaveVideo.C.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 94 of file SaveVideo.C.

virtual SaveVideo::~SaveVideo ( )
inlinevirtual

Virtual destructor for safe inheritance.

Definition at line 131 of file SaveVideo.C.

Member Function Documentation

void SaveVideo::parseSerial ( std::string const &  str,
std::shared_ptr< jevois::UserInterface s 
)
inlineoverridevirtual

Receive a string from a serial port which contains a user command.

Reimplemented from jevois::Module.

Definition at line 190 of file SaveVideo.C.

References jevois::BoundedBuffer< T, WhenFull, WhenEmpty >::filled_size(), itsBuf, itsFilename, itsSaving, LERROR, LINFO, jevois::BoundedBuffer< T, WhenFull, WhenEmpty >::push(), and jevois::Module::sendSerial().

void SaveVideo::postInit ( )
inlineoverridevirtual

Get started.

Reimplemented from jevois::Component.

Definition at line 101 of file SaveVideo.C.

References itsRunFut, itsRunning, and run().

void SaveVideo::process ( jevois::InputFrame &&  inframe)
inlineoverridevirtual
void SaveVideo::run ( )
inlineprotected
void SaveVideo::supportedCommands ( std::ostream &  os)
inlineoverridevirtual

Human-readable description of this Module's supported custom commands.

Reimplemented from jevois::Module.

Definition at line 221 of file SaveVideo.C.

Friends And Related Function Documentation

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

Member Data Documentation

Definition at line 291 of file SaveVideo.C.

Referenced by parseSerial(), postUninit(), process(), and run().

std::string SaveVideo::itsFilename
protected

Definition at line 295 of file SaveVideo.C.

Referenced by parseSerial(), postUninit(), process(), and run().

int SaveVideo::itsFileNum
protected

Definition at line 293 of file SaveVideo.C.

Referenced by run().

std::future<void> SaveVideo::itsRunFut
protected

Definition at line 290 of file SaveVideo.C.

Referenced by postInit(), and postUninit().

std::atomic<bool> SaveVideo::itsRunning
protected

Definition at line 294 of file SaveVideo.C.

Referenced by postInit(), postUninit(), and run().

std::atomic<bool> SaveVideo::itsSaving
protected

Definition at line 292 of file SaveVideo.C.

Referenced by parseSerial(), and process().


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