Ask Your Question

Aruco marker tracking with fixed camera

asked 2017-01-10 22:06:59 -0500

mattewphilyaw gravatar image

I'm trying to implement a tracking system for small robots essentially on a like a table top arena or maybe slightly bigger. I want to be able to track their position/rotation and radio it back to the robot to close the loop on it's navigation.

I believe Aruco markers would be ideal in this case allowing me to track position/rotation/id where I can use the id to radio back to the robot with that position. However, my concern is that most of, if not all examples I see around this are related to figuring out the camera's pose with the camera moving as well as possibly the markers.

In my case the camera would be static in that it would be fixed above the arena would be more focused on the rotation/position of the robots and their distance from each other in a 2d plane in this case. To give a rough idea of arena size maybe 2m x 2m surface and the camera would just be high enough to have the arena in frame if that helps.

Given that setup with a static camera looking down and just moving markers I have a few questions

  1. Is there a better tracking method for this sort of thing in OpenCV? So far Aruco looks like a good starting place from what have used in the examples
  2. I assume camera calibration is still important even in this fixed position?
  3. Do I need to do pose estimation given that I'm restricting this to a locked off camera and more interested in the markers positions within the frame in the xy plane? It's tempting take the corners from the detectMarkers call and work everything out from that especially if I mark the corners of the arena and know the distances between them and ditch the pose estimation.
  4. Lastly, if I'm not mistaken the corners are "fixed" and based on the pattern of the marker correct? My understanding which seems to go with what I observed in running the examples is that the "top" left corner, for example, is defined in a specific spot on the marker and given that the marker carries data that would make sense. The docs are slightly fuzzy and I'm still new to opencv/aruco and machine vision in general so just looking for confirmation.

I have tried to do as much research as possibly but it seems like I'm going slightly against the grain here so most of what I've found I'm reading between the lines, however, it does feel like it would work for my purposes...

edit retag flag offensive close merge delete


Hello @mattewphilyaw I am trying to something very similar to this. However, when I move the marker around, it is not able to track it, as corners are not detected well, (partly due to motion blur, but on tiny lateral movement also, the marker is not detected well) Did you face a similar issue? If so how did you solve it. Thanks!

ShrutheeshIR gravatar imageShrutheeshIR ( 2020-08-04 12:59:40 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-10 23:36:29 -0500

Tetragramm gravatar image
  1. No, Aruco is the best choice in OpenCV.

  2. Yes, it is still important. You very much need the camera matrix and distortion.

  3. You should. This is the proper way to do it. However, you simply reverse the pose to get the position and orientation of the marker relative to the camera, instead of the camera relative to the marker. The code is pretty easy.

    Mat R;
    Rodrigues(rvec, R);
    R = R.t();
    tvec = -R*tvec;
    Rodrigues(R, rvec);

    NOTE: the detectPose functions return the transformation from board coordinates to camera coordinates. This reverses that so camera coordinates become board coordinates. I'm pretty sure what you want is already what you get. If you are defining a world system, you will find the transformation from the camera to the world system, and chain them together like any other coordinate transforms.

  4. Yes, one of the corners is the origin of the marker, I'm pretty sure it's the top-left of the marker or pattern.

edit flag offensive delete link more


@Tetragramm Thanks! Very helpful. I believe I would be defining a world system and that makes sense. Had not thought about in those terms. Gives me some guidance on what to pay attention to in examples now.

mattewphilyaw gravatar imagemattewphilyaw ( 2017-01-11 09:04:37 -0500 )edit

If I may suggest, you can lay the (0,0,0) of the marker in the place you want the (0,0,0) of the world (presumably one corner of your area). Then keep that detected pose and it's the information you need to go from world (which is for this picture the same as the marker) to camera. You'll need to reverse it to go from camera to world.

Then you can take your detected pose in the live system to go marker -> camera, and use the stored to go camera -> world. That gives you a chain of marker -> world, which is what you want.

Tetragramm gravatar imageTetragramm ( 2017-01-11 19:03:42 -0500 )edit

@Tetragramm Can u please answer this question

invincible gravatar imageinvincible ( 2020-06-12 01:43:22 -0500 )edit

Question Tools

1 follower


Asked: 2017-01-10 21:53:40 -0500

Seen: 3,468 times

Last updated: Jan 10 '17