YARP
Yet Another Robot Platform
yarp::sig::file Namespace Reference

Image file operations. More...

Classes

class  soundStreamReader
 

Enumerations

enum  image_fileformat {
  FORMAT_NULL ,
  FORMAT_ANY ,
  FORMAT_PGM ,
  FORMAT_PPM ,
  FORMAT_JPG ,
  FORMAT_NUMERIC ,
  FORMAT_NUMERIC_COMPRESSED ,
  FORMAT_PNG
}
 

Functions

bool read (ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
 
bool read (ImageOf< PixelBgr > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
 
bool read (ImageOf< PixelRgba > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
 
bool read (ImageOf< PixelMono > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
 
bool read (ImageOf< PixelFloat > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
 
bool write (const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
 
bool write (const ImageOf< PixelBgr > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
 
bool write (const ImageOf< PixelRgba > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
 
bool write (const ImageOf< PixelMono > &src, const std::string &dest, image_fileformat format=FORMAT_PGM)
 
bool write (const ImageOf< PixelFloat > &src, const std::string &dest, image_fileformat format=FORMAT_NUMERIC)
 
bool write (const Image &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
 
bool read (Sound &data, const char *filename)
 Read a sound from a generic audio file. More...
 
bool read_bytestream (Sound &data, const char *filename, size_t streamsize, std::string format)
 Read a sound from a byte array. More...
 
bool write (const Sound &data, const char *filename)
 Write a sound to file. More...
 
bool read_mp3_bytestream (Sound &data, const char *bytestream, size_t streamsize)
 Read a sound from a byte array. More...
 
bool read_mp3_file (Sound &data, const char *filename)
 Read a sound from a .mp3 audio file. More...
 
bool write_mp3_file (const Sound &data, const char *filename, size_t bitrate=64000)
 Write a sound to a mp3 file. More...
 
bool read_wav_bytestream (Sound &data, const char *bytestream)
 Read a sound from a byte array. More...
 
bool read_wav_file (Sound &data, const char *filename)
 Read a sound from a .wav audio file. More...
 
bool write_wav_file (const Sound &data, const char *filename)
 Write a sound to a .wav file. More...
 

Detailed Description

Image file operations.

Enumeration Type Documentation

◆ image_fileformat

Enumerator
FORMAT_NULL 
FORMAT_ANY 
FORMAT_PGM 
FORMAT_PPM 
FORMAT_JPG 
FORMAT_NUMERIC 
FORMAT_NUMERIC_COMPRESSED 
FORMAT_PNG 

Definition at line 22 of file ImageFile.h.

Function Documentation

◆ read() [1/6]

bool yarp::sig::file::read ( ImageOf< PixelBgr > &  dest,
const std::string &  src,
image_fileformat  format = FORMAT_ANY 
)

Definition at line 955 of file ImageFile.cpp.

◆ read() [2/6]

bool yarp::sig::file::read ( ImageOf< PixelFloat > &  dest,
const std::string &  src,
image_fileformat  format = FORMAT_ANY 
)

Definition at line 1067 of file ImageFile.cpp.

◆ read() [3/6]

bool yarp::sig::file::read ( ImageOf< PixelMono > &  dest,
const std::string &  src,
image_fileformat  format = FORMAT_ANY 
)

Definition at line 1036 of file ImageFile.cpp.

◆ read() [4/6]

bool yarp::sig::file::read ( ImageOf< PixelRgb > &  dest,
const std::string &  src,
image_fileformat  format = FORMAT_ANY 
)

◆ read() [5/6]

bool yarp::sig::file::read ( ImageOf< PixelRgba > &  dest,
const std::string &  src,
image_fileformat  format = FORMAT_ANY 
)

Definition at line 987 of file ImageFile.cpp.

◆ read() [6/6]

bool yarp::sig::file::read ( Sound data,
const char *  filename 
)

Read a sound from a generic audio file.

Parameters
datasound to read
filenamename of file (supported extensions: .wav, .mp3)
Returns
true on success

Definition at line 35 of file SoundFile.cpp.

◆ read_bytestream()

bool yarp::sig::file::read_bytestream ( Sound data,
const char *  filename,
size_t  streamsize,
std::string  format 
)

Read a sound from a byte array.

Parameters
datasound to read
bytestreamthe byte array
Returns
true on success

Definition at line 56 of file SoundFile.cpp.

◆ read_mp3_bytestream()

bool yarp::sig::file::read_mp3_bytestream ( Sound data,
const char *  bytestream,
size_t  streamsize 
)

Read a sound from a byte array.

Parameters
datasound to read
bytestreamthe byte array
Returns
true on success

Definition at line 459 of file SoundFileMp3.cpp.

◆ read_mp3_file()

bool yarp::sig::file::read_mp3_file ( Sound data,
const char *  filename 
)

Read a sound from a .mp3 audio file.

Parameters
datasound to read
filenamename of file
Returns
true on success

Definition at line 444 of file SoundFileMp3.cpp.

◆ read_wav_bytestream()

bool yarp::sig::file::read_wav_bytestream ( Sound data,
const char *  bytestream 
)

Read a sound from a byte array.

Parameters
datasound to read
bytestreamthe byte array
Returns
true on success

Definition at line 279 of file SoundFileWav.cpp.

◆ read_wav_file()

bool yarp::sig::file::read_wav_file ( Sound data,
const char *  filename 
)

Read a sound from a .wav audio file.

Parameters
datasound to read
filenamename of file
Returns
true on success

Definition at line 236 of file SoundFileWav.cpp.

◆ write() [1/7]

bool yarp::sig::file::write ( const Image src,
const std::string &  dest,
image_fileformat  format = FORMAT_PPM 
)

Definition at line 1202 of file ImageFile.cpp.

◆ write() [2/7]

bool yarp::sig::file::write ( const ImageOf< PixelBgr > &  src,
const std::string &  dest,
image_fileformat  format = FORMAT_PPM 
)

Definition at line 1120 of file ImageFile.cpp.

◆ write() [3/7]

bool yarp::sig::file::write ( const ImageOf< PixelFloat > &  src,
const std::string &  dest,
image_fileformat  format = FORMAT_NUMERIC 
)

Definition at line 1185 of file ImageFile.cpp.

◆ write() [4/7]

bool yarp::sig::file::write ( const ImageOf< PixelMono > &  src,
const std::string &  dest,
image_fileformat  format = FORMAT_PGM 
)

Definition at line 1168 of file ImageFile.cpp.

◆ write() [5/7]

bool yarp::sig::file::write ( const ImageOf< PixelRgb > &  src,
const std::string &  dest,
image_fileformat  format = FORMAT_PPM 
)
Examples
opencv/main.cpp.

Definition at line 1099 of file ImageFile.cpp.

◆ write() [6/7]

bool yarp::sig::file::write ( const ImageOf< PixelRgba > &  src,
const std::string &  dest,
image_fileformat  format = FORMAT_PPM 
)

Definition at line 1144 of file ImageFile.cpp.

◆ write() [7/7]

bool yarp::sig::file::write ( const Sound data,
const char *  filename 
)

Write a sound to file.

The format is specified by the extension.

Parameters
datasound to write
filenamename of file (supported extensions: .wav, .mp3)
Returns
true on success

Definition at line 70 of file SoundFile.cpp.

◆ write_mp3_file()

bool yarp::sig::file::write_mp3_file ( const Sound data,
const char *  filename,
size_t  bitrate = 64000 
)

Write a sound to a mp3 file.

Parameters
datasound to write
filenamename of file
bitratethe compressed audio bitrate
Returns
true on success

Definition at line 199 of file SoundFileMp3.cpp.

◆ write_wav_file()

bool yarp::sig::file::write_wav_file ( const Sound data,
const char *  filename 
)

Write a sound to a .wav file.

Parameters
datasound to write
filenamename of file
Returns
true on success

Definition at line 285 of file SoundFileWav.cpp.