Ask Your Question

Revision history [back]

What's the best tool in OpenCV to achieve this goal with maximum precision in near real-time ?

SolvePnP is exactly what you want to use

Can I use solvePNP with a large amount of points (since all markers are checker pattern) ?

a) Why don't you just try? b) Yes

Is it better to use different checker patterns (two pure checker pattern and the two others would be assymetrical round patterns) ?

asymetric pattern have the large advantage that you don't have to figure out the rotation on a higher level so I'd suggest several circle patterns with different sizes.

Do you recomment to use the calib3D stuff or template matching ?

template matching won't help you here, calib3D is the right tool

Are there any libraries that could simplify that task / implementations of this problem already existing ?

OpenCV already makes this task very easy and straight forward. You can use any calibration tutorial.

For solvePnP you need the coordinates of your features both in 3d (in your case in meters as (xi,yi,0) and in Pixel coordinates. The first feauture (top left corner of pattern 1) should have the coordinates (-B/2, M/2+A,0) and so on. In This way, solvePnP gives you the position relative to your center, even if you don't have a marker there. (Let me guess, you want to place an object in the middle, and reconstruct it in 3d using multiple views)

I'd suggest a code like (Pseudo-Python)

3d_points = []
2d_features = []
for i = 1:4   
   found, 2d_features = findPattern(size_of_Pattern_i)
   if found:
      3d_points.append(3d_positions_of_pattern_i)
      2d_points.append(2d_features)

if len(3d_points)> 0:
  print "at least one marker visible"
  camPose = solvePnP(3d_features, 2d_features, IntrinsicCalibrationData)

The pattern detector has sometimes problems if there are multiple patterns. In this case you could try to mask out a part of your image. If you are tracking your camera (and therefore have a rough guess where it is located), project your patterns into the image and just look at there positions.

What's the best tool in OpenCV to achieve this goal with maximum precision in near real-time ?

SolvePnP is exactly what you want to use

Can I use solvePNP with a large amount of points (since all markers are checker pattern) ?

a) Why don't you just try? b) Yes

Is it better to use different checker patterns (two pure checker pattern and the two others would be assymetrical round patterns) ?

asymetric pattern have the large advantage that you don't have to figure out the rotation on a higher level so I'd suggest several circle patterns with different sizes. sizes (number of features)

Do you recomment to use the calib3D stuff or template matching ?

template matching won't help you here, calib3D is the right tool

Are there any libraries that could simplify that task / implementations of this problem already existing ?

OpenCV already makes this task very easy and straight forward. You can use any calibration tutorial.

For solvePnP you need the coordinates of your features both in 3d (in your case in meters as (xi,yi,0) and in Pixel coordinates. The first feauture (top left corner of pattern 1) should have the coordinates (-B/2, M/2+A,0) and so on. In This way, solvePnP gives you the position relative to your center, even if you don't have a marker there. (Let me guess, you want to place an object in the middle, and reconstruct it in 3d using multiple views)

I'd suggest a code like (Pseudo-Python)

3d_points = []
2d_features = []
for i = 1:4   
   found, 2d_features = findPattern(size_of_Pattern_i)
   if found:
      3d_points.append(3d_positions_of_pattern_i)
      2d_points.append(2d_features)

if len(3d_points)> 0:
  print "at least one marker visible"
  camPose = solvePnP(3d_features, 2d_features, IntrinsicCalibrationData)

The pattern detector has sometimes problems if there are multiple patterns. In this case you could try to mask out a part of your image. If you are tracking your camera (and therefore have a rough guess where it is located), project your patterns into the image and just look at there positions.