JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
Utils.H File Reference
#include <string>
#include <vector>
#include <type_traits>
#include <sstream>
#include <filesystem>
#include <jevois/Util/details/UtilsImpl.H>
Include dependency graph for Utils.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  jevois
 Main namespace for all JeVois classes and functions.
 

Macros

#define ISP_V4L2_PIX_FMT_META   v4l2_fourcc( 'M', 'E', 'T', 'A' )
 Metadata V4L2 format used by Amlogic A311D camera ISP.
 
#define JEVOISPRO_FMT_GUI   v4l2_fourcc( 'J', 'V', 'U', 'I' )
 JeVois-Pro zero-copy display of camera input frame (to be used as output mode in VideoMapping)
 
#define XIOCTL(dev, req, mem)
 Helper macro to execute an ioctl, ignore interruptions, and, if error, issue a fatal message and throw.
 
#define XIOCTL_QUIET(dev, req, mem)
 Helper macro to execute an ioctl, ignore interruptions, and, if error throw quietly.
 
#define XIOCTL_QUIET_ONCE(dev, req, mem)
 Helper macro to execute an ioctl, ignore interruptions, and, if error throw quietly.
 

Functions

std::string jevois::fccstr (unsigned int fcc)
 Convert a V4L2 four-cc code (V4L2_PIX_FMT_...) to a 4-char string.
 
std::string jevois::cvtypestr (unsigned int cvtype)
 Convert cv::Mat::type() code to to a string (e.g., CV_8UC1, CV_32SC3, etc)
 
unsigned int jevois::cvBytesPerPix (unsigned int cvtype)
 Return the number of bytes per pixel for a given OpenCV pixel type.
 
unsigned int jevois::strfcc (std::string const &str)
 Convert a JeVois video format string to V4L2 four-cc code (V4L2_PIX_FMT_...)
 
unsigned int jevois::v4l2BytesPerPix (unsigned int fcc)
 Return the number of bytes per pixel for a given V4L2_PIX_FMT_...
 
unsigned int jevois::v4l2ImageSize (unsigned int fcc, unsigned int width, unsigned int height)
 Return the image size in bytes for a given V4L2_PIX_FMT_..., width, height.
 
unsigned int jevois::blackColor (unsigned int fcc)
 Return a value that corresponds to black for the given video format.
 
unsigned int jevois::whiteColor (unsigned int fcc)
 Return a value that corresponds to white for the given video format.
 
void jevois::applyLetterBox (unsigned int &imw, unsigned int &imh, unsigned int const winw, unsigned int const winh, bool noalias)
 Apply a letterbox resizing to fit an image into a window.
 
std::vector< std::string > jevois::split (std::string const &input, std::string const &regex="\\s+")
 Split string into vector of tokens using a regex to specify what to split on; default regex splits by whitespace.
 
template<typename T >
std::string jevois::join (std::vector< T > const &tokens, std::string const &delimiter)
 Concatenate a vector of tokens into a string.
 
template<>
std::string jevois::join< std::string > (std::vector< std::string > const &tokens, std::string const &delimiter)
 Concatenate a vector of string tokens into a string.
 
bool jevois::stringStartsWith (std::string const &str, std::string const &prefix)
 Return true if str starts with prefix (including if both strings are equal)
 
std::string jevois::replaceWhitespace (std::string const &str, char rep='_')
 Replace white space characters in a string with underscore (default) or another character.
 
std::string jevois::strip (std::string const &str)
 Strip white space (including CR, LF, tabs, etc) from the end of a string.
 
std::string jevois::extractString (std::string const &str, std::string const &startsep, std::string const &endsep)
 Extract a portion of a string between two delimiters.
 
size_t jevois::replaceStringFirst (std::string &str, std::string const &from, std::string const &to)
 Replace first instance of 'from' with 'to'.
 
size_t jevois::replaceStringAll (std::string &str, std::string const &from, std::string const &to)
 Replace all instances of 'from' with 'to'.
 
std::string jevois::replaceAll (std::string const &str, std::string const &from, std::string const &to)
 Replace all instances of 'from' with 'to'.
 
std::string jevois::tolower (std::string const &str)
 Convert string to lowercase.
 
std::filesystem::path jevois::absolutePath (std::filesystem::path const &root, std::filesystem::path const &path)
 Compute an absolute path from two paths.
 
std::string jevois::sformat (char const *fmt,...) __attribute__((format(__printf__
 Create a string using printf style arguments.
 
template<typename T >
std::string T jevois::from_string (std::string const &str)
 Convert from string to a type.
 
template<typename T >
std::string jevois::to_string (T const &val)
 Convert from type to string.
 
template<typename dest_type , typename source_type >
dest_type jevois::clamped_convert (source_type source)
 Clamped numerical conversion.
 
void jevois::flushcache ()
 Flush the caches, may sometimes be useful when running the camera in turbo mode.
 
std::string jevois::system (std::string const &cmd, bool errtoo=true)
 Execute a command and grab stdout output to a string.
 
std::string jevois::secs2str (double secs)
 Report a duration given in seconds with variable units (ns, us, ms, or s), with precision of 2 decimal points.
 
std::string jevois::secs2str (std::vector< double > secs)
 Report avg+/-std duration given in seconds with variable units (ns, us, ms, or s), with 1 decimal point.
 
void jevois::secs2str (std::ostringstream &ss, double secs)
 Report a duration given in seconds with variable units (ns, us, ms, or s)
 
std::string jevois::num2str (double n)
 Report a number with variable multipliers (K, M, G, T, P, E, Z, Y), with precision of 2 decimal points.
 
void jevois::num2str (std::ostringstream &ss, double n)
 Report a number with variable multipliers (K, M, G, T, P, E, Z, Y)
 
std::string jevois::getFileString (char const *fname, int skip=0)
 Read one line from a file and return it as a string.
 

Macro Definition Documentation

◆ ISP_V4L2_PIX_FMT_META

#define ISP_V4L2_PIX_FMT_META   v4l2_fourcc( 'M', 'E', 'T', 'A' )

Metadata V4L2 format used by Amlogic A311D camera ISP.

Definition at line 27 of file Utils.H.

◆ JEVOISPRO_FMT_GUI

#define JEVOISPRO_FMT_GUI   v4l2_fourcc( 'J', 'V', 'U', 'I' )

JeVois-Pro zero-copy display of camera input frame (to be used as output mode in VideoMapping)

Note that the underlying mode is RGBA as used by MALI OpenGL

Definition at line 31 of file Utils.H.