JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
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

 jevois
 

Macros

#define ISP_V4L2_PIX_FMT_META   v4l2_fourcc( 'M', 'E', 'T', 'A' )
 Metadata V4L2 format used by Amlogic A311D camera ISP. More...
 
#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) More...
 

Functions

std::string jevois::fccstr (unsigned int fcc)
 Convert a V4L2 four-cc code (V4L2_PIX_FMT_...) to a 4-char string. More...
 
std::string jevois::cvtypestr (unsigned int cvtype)
 Convert cv::Mat::type() code to to a string (e.g., CV_8UC1, CV_32SC3, etc) More...
 
unsigned int jevois::cvBytesPerPix (unsigned int cvtype)
 Return the number of bytes per pixel for a given OpenCV pixel type. More...
 
unsigned int jevois::strfcc (std::string const &str)
 Convert a JeVois video format string to V4L2 four-cc code (V4L2_PIX_FMT_...) More...
 
unsigned int jevois::v4l2BytesPerPix (unsigned int fcc)
 Return the number of bytes per pixel for a given V4L2_PIX_FMT_... More...
 
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. More...
 
unsigned int jevois::blackColor (unsigned int fcc)
 Return a value that corresponds to black for the given video format. More...
 
unsigned int jevois::whiteColor (unsigned int fcc)
 Return a value that corresponds to white for the given video format. More...
 
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. More...
 
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. More...
 
std::string jevois::join (std::vector< std::string > const &strings, std::string const &delimiter)
 Concatenate a vector of tokens into a string. More...
 
bool jevois::stringStartsWith (std::string const &str, std::string const &prefix)
 Return true if str starts with prefix (including if both strings are equal) More...
 
std::string jevois::replaceWhitespace (std::string const &str, char rep='_')
 Replace white space characters in a string with underscore (default) or another character. More...
 
std::string jevois::strip (std::string const &str)
 Strip white space (including CR, LF, tabs, etc) from the end of a string. More...
 
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. More...
 
size_t jevois::replaceStringFirst (std::string &str, std::string const &from, std::string const &to)
 Replace first instance of 'from' with 'to'. More...
 
size_t jevois::replaceStringAll (std::string &str, std::string const &from, std::string const &to)
 Replace all instances of 'from' with 'to'. More...
 
std::string jevois::replaceAll (std::string const &str, std::string const &from, std::string const &to)
 Replace all instances of 'from' with 'to'. More...
 
std::string jevois::tolower (std::string const &str)
 Convert string to lowercase. More...
 
std::filesystem::path jevois::absolutePath (std::filesystem::path const &root, std::filesystem::path const &path)
 Compute an absolute path from two paths. More...
 
std::string jevois::sformat (char const *fmt,...) __attribute__((format(__printf__
 Create a string using printf style arguments. More...
 
template<typename T >
std::string T jevois::from_string (std::string const &str)
 Convert from string to a type. More...
 
template<typename T >
std::string jevois::to_string (T const &val)
 Convert from type to string. More...
 
template<typename dest_type , typename source_type >
dest_type jevois::clamped_convert (source_type source)
 Clamped numerical conversion. More...
 
void jevois::flushcache ()
 Flush the caches, may sometimes be useful when running the camera in turbo mode. More...
 
std::string jevois::system (std::string const &cmd, bool errtoo=true)
 Execute a command and grab stdout output to a string. More...
 
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. More...
 
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. More...
 
void jevois::secs2str (std::ostringstream &ss, double secs)
 Report a duration given in seconds with variable units (ns, us, ms, or s) More...
 
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. More...
 
void jevois::num2str (std::ostringstream &ss, double n)
 Report a number with variable multipliers (K, M, G, T, P, E, Z, Y) More...
 
std::string jevois::getFileString (char const *fname, int skip=0)
 Read one line from a file and return it as a string. More...
 

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.