ALVisionToolbox API

Overview | API | Tutorial

Namespace : AL

#include <alproxies/alvisiontoolboxproxy.h>

Methods

int ALVisionToolboxProxy::backlighting()

Indicates if NAO’s active camera is in backlighting conditions.

Returns:
  • 0: no backlight
  • 1: possible backlight
  • 2: backlight identified
void ALVisionToolboxProxy::halfPress()

Optional : prepares camera for shooting (like the auto-focus on standard and digital cameras)

int ALVisionToolboxProxy::isItDark()

Tell if NAO’s is in a dark environment.

Returns:
  • [0;4] outdoor
  • [5;100] indoor bright
  • [101;127] indoor artificial light
  • [128;210] indoor weak lights
  • [211;255] dark place
bool ALVisionToolboxProxy::isVideoRecording()
Returns:
void ALVisionToolboxProxy::logTPRInstanceInfo(const int& instanceNumber)

Shows logs related to ALVisionToolboxProxy::takePictureRegularly.

Parameters:
  • instanceNumber – number of the instance we want to get info on
void ALVisionToolboxProxy::setWhiteBalance(const int& camera)

Set white balance by using NAO’s white hands as reference. A call to this method makes NAO move his arm.

Parameters:
  • camera

    Camera we want to set white balance to :

    • [0] top
    • [1] bottom
    • [2] both
void ALVisionToolboxProxy::startVideoRecord(const std::string& videoName)

Start recording a video. The .avi video is stored on the robot in the “/home/nao/.local/share/naoqi/share/naoqi/vision” folder. The record should be stopped by calling ALVisionToolboxProxy::stopVideoRecord. Resolution: 320*240, MJPG format, frame rate ~10-15 fps.

Note

Only one record at a time can be made.

param videoName:
 Name of the video file to be recorded
void ALVisionToolboxProxy::startVideoRecord_adv(const std::string& videoName, const float& framerate, const std::string& format, const int& resIndex, const int& numFrames)

Start recording a video, with advanced options. Please note that only one record at a time can be made.

Parameters:
  • videoName – Name of the video file to be recorded.
  • framerate – Record frame rate [0.1-50.0]. Warning: MJPG format requires framerate greater than 2.0.
  • format
    • ARV (raw YUV422 format)
    • IYUV (raw avi)
    • MJPG (compressed avi)
  • resIndex – Resolution index (e.g. kQQVGA, kQVGA, kVGA, k4VGA)
  • numFrames – Number of frames to record. If less than 0, it records until stopVideoRecord() is called.
void ALVisionToolboxProxy::stopTPR(const std::string& pathAndNameRoot, const std::string& imageRecordFormat)

Stop an instance of ALVisionToolboxProxy::takePictureRegularly.

Parameters:
  • pathAndNameRoot – path and name root of the file we want to stop recording
  • imageRecordFormat – formats of the file we want to stop recording
AL::ALValue ALVisionToolboxProxy::stopVideoRecord()

Stop a video record that was launched with ALVisionToolboxProxy::startVideoRecord or ALVisionToolboxProxy::startVideoRecord_adv. The function returns the number of frames that were recorded, as well as the video absolute path.

Returns:Array of two elements [numRecordedFrames, recordAbsolutePath]
void ALVisionToolboxProxy::takePicture()

Shoot 3 successives pictures and place them in the “/home/nao/.local/share/naoqi/share/naoqi/vision” folder.

Note

The call to this method can be shortened by calling ALVisionToolboxProxy::halfPress before.

void ALVisionToolboxProxy::takePictureRegularly(const float& secondsBetweenTwoShots, const std::string& pathAndNameRoot, const bool& overwriteImage, const std::string& imageRecordFormat, const int& resolution)

Shoot regularly a picture to follow NAO’s evolution in his environment. Up to 8 instances for this blocking function can be launched, as long as pathAndNameRoot and/or imageRecordFormat parameters are different between two instances.

Parameters:
  • secondsBetweenTwoShots – Time in seconds between two pictures
  • pathAndNameRoot – path and the root of the name for the picture
  • overwriteImage
    • if True, one image will be regularly overwritten,
    • if False, new images will be regularly created (each being appended by a timestamp)
  • imageRecordFormat – jpeg, bmp, png
  • resolution – image resolution (e.g. kQQVGA, kQVGA)