ALPhotoCapture API

NAOqi Vision - Overview | API | Tutorial


Namespace : AL


           
            #include <alproxies/alphotocaptureproxy.h>

           
          

Methods

int ALPhotoCaptureProxy:: getCameraID ( )

Returns the ID of the camera used to take pictures.

Returns: camera ID.
int ALPhotoCaptureProxy:: getCaptureInterval ( )

Returns the current delay in millisecond between two pictures.

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.

bool ALPhotoCaptureProxy:: halfPress ( )

Deprecated since version 1.18: use ALPhotoCaptureProxy::setHalfPressEnabled instead.

Toggles the halfPress mode between on and off depending on the current state.

Returns: true in case of success, false otherwise.
bool ALPhotoCaptureProxy:: isHalfPressed ( )

Deprecated since version 1.18: use ALPhotoCaptureProxy::isHalfPressEnabled instead.

Returns the current status of halfPress mode (true if it is on, false otherwise).

bool ALPhotoCaptureProxy:: isHalfPressEnabled ( )

Returns the current status of halfPress mode.

Returns: true if the halfPress mode is on, false otherwise.
void ALPhotoCaptureProxy:: setCameraID ( const int& cameraID )

Sets the camera used to take pictures.

Parameters:
  • cameraID – ID of the camera (see cameraindex ).
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.
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 }.
bool ALPhotoCaptureProxy:: setHalfPressEnabled ( const bool& enable )

Enable or disables the halfPress mode.

Parameters:
  • enable – true to turn the halfPress mode on, off to turn it off.
Returns:

true in case of success, false otherwise.

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 used to take pictures.

Parameters:
  • resolution – One of the resolutions supported by the robot. For the full list of supported resolutions by robot, see: cameraresolution .
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 underscore (“_”) and the picture number to the end of the file name and before the extension. You will find an example on the Tutorial page.