NAOqi Vision - Overview | API | Tutorials
See also
ALLandMarkDetection is a vision module, in which NAO recognizes special landmarks with specific patterns on them. We call those landmarks Naomarks.
You can use the ALLandMarkDetection module for various applications. For example, you can place those landmarks at different locations in NAO’s field of action. Depending on which landmark NAO detects, you can get some information on NAO’s location. Coupled with other sensor information, it can help you build a more robust localization module.
Naomarks consist of black circles with white triangle fans centered at the circle’s center. The specific location of the different triangle fans is used to distinguish one Naomark from the others.
The Landmark detection module is a GVM, a client module registering itself to the VIM (Vision Input Module).
See ALVideoDevice - Advanced section, for further details on:
Lighting: the landmark detection has been tested under office lighting conditions - ie, under 100 to 500 lux. As the detection itself relies on contrast differences, it should actually behave well as long as the marks in your input images are reasonably well contrasted. If you feel that the detection is not running well, make sure the camera auto gain is activated - via the Monitor interface - or try to adjust manually the camera contrast.
Size range for the detected Marks:
Minimum: ~0.035 rad = 2 deg. It corresponds to ~14 pixels in a QVGA image
Maximum: ~0.40 rad = 23 deg. It corresponds to ~160 pixels in a QVGA image
Tilt: +/- 60 deg (0 deg corresponds to the mark facing the camera)
Rotation in image plane: invariant.
You can find Naomarks on the CD in the folder Media (Naomark.pdf).
To get a feel of what the ALLandMarkDetection can do, you can use Monitor and launch the vision plugin. Activate the LandMarkDetection checkbox and start the camera acquisition. Then, if you place a Naomark somewhere in the camera’s field of vision, Monitor should report the detected naomarks by circling them on the video output pane. In addition, the naomark identifier is displayed next to the circle and should correspond to real naomark’s identifier.
To start the naomark detection function, use a ALLandMarkDetection proxy to subscribe to ALLandMarkDetection. In Python, the code for this subscription is:
from naoqi import ALProxy
IP = "your_robot_ip"
PORT = 9559
# Create a proxy to ALLandMarkDetection
markProxy = ALproxy("ALLandMarkDetection", IP, PORT)
# Subscribe to the ALLandMarkDetection extractor
period = 500
markProxy.subscribe("Test_Mark", period, 0.0 )
The period parameter specifies - in milliseconds - how often ALLandMarkDetection tries to run its detection method and outputs the result in an ALMemory output variable called LandmarkDetected.
Once at least one subscription to the ALLandMarkDetection module is made, ALLandMarkDetection starts to run.
The ALLandMarkDetection module writes its results in a variable in ALMemory (LandmarkDetected).
As you surely want to use the detection results directly in your code, you can check the ALMemory’s variable on a regular basis. To do this, just create a proxy to ALMemory, and retrieve the landmark variable using getData(“LandmarkDetected”) from the ALMemory proxy.
from naoqi import ALProxy
IP = "your_robot_ip"
PORT = 9559
# Create a proxy to ALMemory.
memProxy = ALProxy("ALMemory", IP, PORT)
# Get data from landmark detection (assuming face detection has been activated).
data = memProxy.getData("LandmarkDetected")
If no naomarks are detected, the variable is empty. More precisely, it is an array with zero element, (ie, printed as [ ] in python).
If N naomarks are detected, then the variable structure consists of two fields:
[ [ TimeStampField ] [ Mark_info_0 , Mark_info_1, . . . , Mark_info_N-1 ] ] with: