ALDarknessDetection API

NAOqi Vision - Overview | API

Namespace : AL

#include <alproxies/aldarknessdetectionproxy.h>

Events lists

ALMemory Keys list

Methods

int ALDarknessDetectionProxy::getDarknessThreshold()
Returns:Current value of the darkness threshold used for raising the event DarknessDetected().
void ALDarknessDetectionProxy::setDarknessThreshold(const int& threshold)

Enables to change the value of the darkness threshold for raising the event DarknessDetected().

This value must be between 0 and 100:

  • if the given value is lower than 0, darkness threshold is set to 0
  • if the given value is greater than 100, darkness threshold is set to 100

Methods inherited from ALVisionExtractor

int ALDarknessDetectionProxy::getActiveCamera()
Returns:Index of the active camera (0: top camera, 1: bottom camera)
int ALDarknessDetectionProxy::getFrameRate()
Returns:Current extractor framerate in frames per second (range: 1-30 fps)
int ALDarknessDetectionProxy::getResolution()
Returns:Index of the current resolution (0: QQVGA, 1: QVGA, 2: VGA, 3: 4VGA)
bool ALDarknessDetectionProxy::isPaused()
Returns:True if the extractor is paused (subscribed but not running).
bool ALDarknessDetectionProxy::isProcessing()
Returns:True if the extractor is processing images (at least one subscriber).
bool ALDarknessDetectionProxy::setActiveCamera(const int& cameraId)

Sets the camera from which the processed images will be taken. This does not change the active camera for other modules.

Parameters:
  • cameraId – Index of the desired camera.
Returns:

True if the active camera has been successfully set.

Warning

If you use this function, the active camera of this module will not be linked to the “default” camera of the robot anymore. This means that the function setParam(kCameraSelectID) will not affect the active camera of this module. If you want the module to follow the “default” camera again, you can use the function ALDarknessDetectionProxy::setActiveCamera(-1).

bool ALDarknessDetectionProxy::setFrameRate(const int& framerate)

Sets the extractor framerate (the number of processes per second).

Parameters:
  • framerate – Desired framerate: must be between 1 and 30.
Returns:

True if the framerate has been successfully changed.

bool ALDarknessDetectionProxy::setResolution(const int& resolution)

Sets the resolution of the image to be processed.

Parameters:
  • resolution – Desired resolution. 0: QQVGA, 1: QVGA, 2: VGA, 3: 4VGA.
Returns:

True if the resolution has been successfully changed.

Events

Event: "DarknessDetected"
callback(std::string eventName, int value, std::string subscriberIdentifier)

Raised when the darkness value just became greater than the darkness threshold. As long as the darkness value stays over the threshold, the event is not raised another time.

Parameters:
  • eventName (std::string) – “DarknessDetected”
  • value – the darkness value measured
  • subscriberIdentifier (std::string) –

Note

This event should be prefixed by DarknessDetection/ when subscribing to it.

ALMemory Keys

int DarknessValue

Value of the darkness measured for each frame.

Full name in ALMemory: DarknessDetection/DarknessValue