Skip to content

ArUco Marker Detection ​

Instance declaration ​

When you add an ArUco Marker Detection block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
aruco_marker = ArucoMarker(0)
# When there are multiple instances
aruco_marker_1 = ArucoMarker(1)

Parameters ​

NameKindDescriptionRange / TypeDefault
indexDropdown optionInstance number (starting from 0)Integer 0 or greater0

Select the camera device ​

Sets the camera to use for ArUco marker detection.

device

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionCamera device nameSystem camera label-

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.device('')

Set the maximum marker count ​

Sets the maximum number of markers that can be recognized. The marker count ranges from 0 to 10.

max_count

Parameters ​

NameKindDescriptionRange / TypeDefault
dataInput (block)Maximum marker countInteger 0 to 10-

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.max_count(5)

Detect once ​

Finds the markers currently on screen and marks their regions just once.

detect_once

Parameters ​

(none)

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.detect_once()

Start / stop continuous detection ​

Keeps following the markers currently on screen and marks their regions on the screen.

detect_continuous

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionActionstart, stop-

Python ​

python
aruco_marker = ArucoMarker(0)

# unit = "start"
aruco_marker.detect_continuous()
# unit = "stop"
aruco_marker.stop()

Show the detection result ​

Decides whether or not to show the marker detection result on the camera screen.

display

Parameters ​

NameKindDescriptionRange / TypeDefault
onDropdown optionDisplay ON / OFFshow (on=True), hide (off=False)TRUE

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.display(True)
aruco_marker.display(False)

Marker data ​

Returns the position/size values of the specified marker ID.

marker_data

Parameters ​

NameKindDescriptionRange / TypeDefault
dataInput (block)Marker IDInteger 0 or greater-
unitDropdown optionKind of measurementx, y, min_x, max_x, min_y, max_y, width, height, area, rotation-

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.marker(0, 'x')
aruco_marker.marker(3, 'area')

Distance between markers ​

Returns the distance between two markers.

marker_to_marker

Parameters ​

NameKindDescriptionRange / TypeDefault
unit1Input (block)First marker IDInteger 0 or greater-
unit2Input (block)Second marker IDInteger 0 or greater-
typeDropdown optionKind of distancedistance (omitted or None), horizontal distance (horizontal), vertical distance (vertical)None

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.get_distance(0, 1)  # distance
aruco_marker.get_distance(0, 2, 'horizontal')  # horizontal distance

Whether a marker was detected ​

Whether a marker with the given id value was found

marker_detected

Parameters ​

NameKindDescriptionRange / TypeDefault
dataInput (block)Marker IDInteger 0 or greater-

Python ​

python
aruco_marker = ArucoMarker(0)

aruco_marker.marker_detected(0)