YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::sig::file Namespace Reference

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.
 
bool read_bytestream (Sound &data, const char *bytestream, size_t streamsize, std::string format)
 Read a sound from a byte array.
 
bool write_bytestream (const Sound &data, char *bytestream, size_t &streamsize, std::string format)
 Writes a sound to a byte array.
 
bool write (const Sound &data, const char *filename)
 Write a sound to file.
 
bool read_mp3_bytestream (Sound &data, const char *bytestream, size_t streamsize)
 Read a sound from a byte array.
 
bool read_mp3_file (Sound &data, const char *filename)
 Read a sound from a .mp3 audio file.
 
bool write_mp3_file (const Sound &data, const char *filename, size_t bitrate=64000)
 Write a sound to a mp3 file.
 
bool write_mp3_bytestream (const Sound &data, char *bytestream, size_t &streamsize)
 write a sound from a byte array.
 
bool read_wav_bytestream (Sound &data, const char *bytestream, size_t streamsize)
 Read a sound from a byte array.
 
bool read_wav_file (Sound &data, const char *filename)
 Read a sound from a .wav audio file.
 
bool write_wav_bytestream (const Sound &data, char *bytestream, size_t &streamsize)
 Write a sound to a byte array.
 
bool write_wav_file (const Sound &data, const char *filename)
 Write a sound to a .wav file.
 

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 14 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 958 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 1070 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 1039 of file ImageFile.cpp.

◆ read() [4/6]

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

Definition at line 926 of file ImageFile.cpp.

◆ read() [5/6]

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

Definition at line 990 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 *  bytestream,
size_t  streamsize,
std::string  format 
)

Read a sound from a byte array.

Parameters
datasound to read (output)
bytestreamthe byte array (input)
streamsizesize of the byte array (input)
formatformat of the audio data (e.g., "wav", "mp3")
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 [output]
bytestreamthe byte array [input]
streamsizesize of the byte array [input]
Returns
true on success

Definition at line 712 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 697 of file SoundFileMp3.cpp.

◆ read_wav_bytestream()

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

Read a sound from a byte array.

Parameters
datasound to read [output]
bytestreamthe byte array [input]
streamsizesize of the byte array [input]
Returns
true on success

Definition at line 429 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 386 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 1205 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 1123 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 1188 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 1171 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 1102 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 1147 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_bytestream()

bool yarp::sig::file::write_bytestream ( const Sound &  data,
char *  bytestream,
size_t &  streamsize,
std::string  format 
)

Writes a sound to a byte array.

Parameters
datasound to write (intput)
bytestreamthe returned byte array (output)
streamsizethe returned size of the byte array (output)
formatformat of the audio data (e.g., "wav", "mp3")
Returns
true on success

Definition at line 92 of file SoundFile.cpp.

◆ write_mp3_bytestream()

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

write a sound from a byte array.

Parameters
datasound to write [input]
bytestreamthe byte array [output]
streamsizethe size of the byte array [output]
Returns
true on success

Definition at line 718 of file SoundFileMp3.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 290 of file SoundFileMp3.cpp.

◆ write_wav_bytestream()

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

Write a sound to a byte array.

Parameters
datasound to write [input]
bytestreamthe byte array [output]
streamsizethe size of the byte array [output]
Returns
true on success

Definition at line 435 of file SoundFileWav.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 [input]
filenamename of file [output]
Returns
true on success

Definition at line 442 of file SoundFileWav.cpp.