mp.tasks.vision.drawing_utils.draw_axis
Draws the 3D axis on the image.
mp.tasks.vision.drawing_utils.draw_axis(
image: np.ndarray,
rotation: np.ndarray,
translation: np.ndarray,
focal_length: tuple[float, float] = (1.0, 1.0),
principal_point: tuple[float, float] = (0.0, 0.0),
axis_length: float = 0.1,
axis_drawing_spec: mp.tasks.vision.drawing_utils.DrawingSpec = DrawingSpec()
)
Args |
image
|
A three channel BGR image represented as numpy ndarray.
|
rotation
|
Rotation matrix from object to camera coordinate frame.
|
translation
|
Translation vector from object to camera coordinate frame.
|
focal_length
|
camera focal length along x and y directions.
|
principal_point
|
camera principal point in x and y.
|
axis_length
|
length of the axis in the drawing.
|
axis_drawing_spec
|
A DrawingSpec object that specifies the xyz axis drawing
settings such as line thickness.
|
Raises |
ValueError
|
If one of the followings:
a) If the input image is not three channel BGR.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-05 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-05 UTC."],[],[]]