ALPhotoCapture API

NAOqi Vision - Overview | API | Tutorial


Namespace : AL

#include <alproxies/alphotocaptureproxy.h>

Methods

int ALPhotoCaptureProxy::getColorSpace()

Returns the current color space (either kBGRColorSpace or kYuvColorSpace).

std::string ALPhotoCaptureProxy::getPictureFormat()

Returns the current picture extension. See ALPhotoCaptureProxy::setPictureFormat() for the list of possible return values.

int ALPhotoCaptureProxy::getResolution()

Returns the current frame resolution.

int ALPhotoCaptureProxy::getCaptureInterval()

Returns the current delay in millisecond between two pictures.

void ALPhotoCaptureProxy::setColorSpace(const int& colorSpace)

Sets the color space used. It must be either kBGRColorSpace (for color images) or kYuvColorSpace (for gray-scale images).

Parameters:
  • colorSpace – New color space { 0 = kYuvColorSpace, 13 = kBGRColorSpace }.
void ALPhotoCaptureProxy::setPictureFormat(const std::string& pictureFormat)

Sets the image format used to save the pictures. This also corresponds to the file extension added to the filename.

Parameters:
  • pictureFormat – File format. Possible values are “bmp”, “dib”, “jpeg”, “jpg”, “jpe”, “png”, “pbm”, “pgm”, “ppm”, “sr”, “ras”, “tiff”, “tif”.
void ALPhotoCaptureProxy::setResolution(const int& resolution)

Sets the frame resolution. It can be either VGA, QVGA or QQVGA.

Parameters:
  • resolution – New resolution { 0 = kQQVGA, 1 = kQVGA, 2 = kVGA }.
void ALPhotoCaptureProxy::setCaptureInterval(const int& captureInterval)

Sets the time period between which two successive shots.

Parameters:
  • captureInterval – New time period between pictures in millisecond. The default value, 200, corresponds to 5 images taken per second.
AL::ALValue ALPhotoCaptureProxy::takePicture(const std::string& folderPath, const std::string& fileName)

There are two overloads of this function:

Takes one picture at the given resolution and stores it on the disk. The file format is determined by the extension (see ALPhotoCaptureProxy::setPictureFormat() for the list of supported extensions). If the destination file already exists, it will be overwritten.

Parameters:
  • folderPath – Path were the file will be save.
  • fileName – Name used to save the picture.
Returns:

Array of one element [fileName].

AL::ALValue ALPhotoCaptureProxy::takePicture(const std::string& folderPath, const std::string& fileName, const bool& overwrite)

Takes one picture at the given resolution and stores it on the disk. The file format is determined by the extension (see ALPhotoCaptureProxy::setPictureFormat() for the list of supported extensions).

Parameters:
  • folderPath – Path were the file will be save.
  • fileName – Name used to save the picture.
  • overwrite – If you set this value to False and the destination file already exists, the method will return and throw an exception. No data will be saved on disk and the existing file will be preserved.
Returns:

Array of one element [fileName].

AL::ALValue ALPhotoCaptureProxy::takePictures(const int& numberOfPictures, const std::string& folderPath, const std::string& fileName)

There are two overloads of this function:

Takes several pictures in a row and stores them on disk. If the destination file already exists, it will be overwritten.

Parameters:
  • numberOfPictures – Number of pictures to be taken.
  • folderPath – Path were the files will be save.
  • fileName – Name used to save the pictures. The actual names construction is detailed below.
Returns:

Array containing the list of the recorded file names [listOfNames] where listOfNames is an array of strings [name1, name2...].

AL::ALValue ALPhotoCaptureProxy::takePictures(const int& numberOfPictures, const std::string& folderPath, const std::string& fileName, const bool& overwrite)

Takes several pictures in a row and stores them on disk.

Parameters:
  • numberOfPictures – Number of pictures to be taken.
  • folderPath – Path were the files will be save.
  • fileName – Name used to save the pictures. The actual names construction is detailed below.
  • overwrite – If you set this value to False, then takePicture will stop saving pictures if one of them has the same file name as an existing file. An exception will be thrown if such a case happens.
Returns:

Array containing the list of the recorded file names [listOfNames] where listOfNames is an array of strings [name1, name2...].

Note

Since this function saves several pictures to disk, we have to create different file names. This is done by appending an undescore (“_”) and the picture number to the end of the file name and before the extension. You will find an example on the Tutorial page.