/aruco_locating

Remove overlap region in polygons, while reduceing the intersection boundaries as possible.

Primary LanguageC++

Aruco locating

An application that use DSLR camera to track the pose(position and orientation) of ArUco markers in images, video or live video(not implemented yet).

aruco_locating

Description:

  1. The program detects ArUco markers in image, this program allows user set parameters regarding to the detection algorithm and determine the detection regions on images.
  2. Using IPPE algorithm (A Perspective-n-Point(PnP) Method) to track the pose of detected markers. The global coordinate system is the camera coordinate system. Hence, the origin is at camera center.
  3. Using Bundle Adjustment to refine calculated markers pose (Can be turned off).
  4. User could visualize and get a tracking result csv file. The csv file conatins marker's IDs, position and pose information, sorted by image.


ArUco marker

Library Package Installation

  1. VTK: For marker tracking result visualization.
  2. Eigen For matrix calculation.
  3. OpenCV: For ArUco marker detection, pose estimation and image I/O. Opencv Contrib Module is required(viz).
  4. g2o: For Bundle Adjustment.
  5. MarkerBA: For marker-based Bundle Adjustment (Optimizing marker pose rather than marker corners positions).
  6. json: For json file I/O.

How to use:

  1. Aruco marker preparation: Print and Place ArUco markers where you want to track. Fill in marker size (meter) in config/params.json. If having markers with different size, fill in the size with specified ID in "specialMarkerSize".

  2. Camera calibration: Using exsited camera calibration tools to obtain camera intrinsic matrix and distortion coeeficient. Fill in camera matrix(kmat) and distortion coefficient(distmat) in config/params.json. During and after this step, the camera auto focus must be turned off.


  3. Include files

  4. Declare ArucoLocating

  5. (Optional) Declare ArucoLocating::arucoDetectionSet(source, sourcePath): Adjust the aruco detection algorithm parameters. Recommanded for blurred or scenario that marker is hard to detect.

  6. Declare ArucoLocating::run(source,sourcePath,BA,monitor,parallel):

    • Source: Source::IMG for img file; Source Vidoe for video file
    • sourcePath: folder where the images stored or the path of the video file
    • BA: Turn on/off Bundle Adjustment for optimizing marker pose.
    • monitor: 3D Visualize each img/frame marker detection and tracking result.
    • parallel: Allow Multiprocess for better efficiency.

    Hint: When parallel is on, monitor cannot be switched on.

  7. Declare ArucoLocating.save(path): Save the marker tracking result as csv file in specificed path.

//4
#include "pch.h"
#include "aruco_locating.h"

int main(){
	ArucoLocating arucoLocator;  //5
	//arucoLocator.arucoDetectionSet(Source::IMAGE, "asset/imgs"); //6
	arucoLocator.run(Source::IMAGE, "asset/imgs", true,false, true);  //7
	arucoLocator.save("asset/saved"); //8
}
  • Detection Result csv: overlap_elimination
  • Visualziation: visualize

Reference

  1. Garrido-Jurado, Sergio, et al. "Automatic generation and detection of highly reliable fiducial markers under occlusion." Pattern Recognition 47.6 (2014): 2280-2292.
  2. https://github.com/HeYijia/MarkerBA/tree/master
  3. Collins, Toby, and Adrien Bartoli. "Infinitesimal plane-based pose estimation." International journal of computer vision 109.3 (2014): 252-286.
  4. 高翔, 视觉 SLAM 十四讲: 从理论到实践. 电子工业出版社, 2017.
  5. Graphics Designed By TIM-Chang From LovePik.com