show aruco marker axis opencv python

rvec, tvec, markerPoints = aruco.estimatePoseSingleMarkers(corners[i], 0.02, matrix_coefficients,
                                                                           distortion_coefficients)
(rvec - tvec).any()  # get rid of that nasty numpy value array error
aruco.drawDetectedMarkers(frame, corners)  # Draw A square around the markers
aruco.drawAxis(frame, matrix_coefficients, distortion_coefficients, rvec, tvec, 0.01)  # Draw axis

Here is what the above code is Doing:
1. It’s creating a dictionary of markers with ids from 0-255 with some default
values for the markers.
2. It’s creating a video capture object to read from your webcam
3. It’s reading the first frame from the stream and converting it to black and
white (which is necessary for detecting the Aruco markers).
4. It’s detecting the markers in the image and getting their corners.
5. It’s estimating the pose of these corners and drawing them on the image.
6. It’s displaying this image.