Skip to main content

Aruco Scale Factor Estimation

Project description

Automatic Estimation of the Scale Factor Based on Aruco Markers (Work in Progress!)

PyPI - Python Version PyPI GitHub Workflow Status license

About

This project aims to automatically compute the correct scale of a point cloud generated with COLMAP by placing an aruco marker into the scene.

Installation

PyPi

This repository is tested on Python 3.6+ and can be installed from PyPi

pip install aruco-estimator

Usage

Dataset

An exemplary data set is provided. The dataset shows a simple scene of a door with an aruco marker. Other dataset might follow in future work. It can be downloaded by using

from aruco_estimator import download

dataset = download.Dataset()
dataset.download_door_dataset(output_path='.')

API

A use of the code on the provided dataset can be seen in the following block. The most important function is aruco_scale_factor.run(). Here, an aruco marker is searched for in each image. If a marker is found in at least 2 images, the position of the aruco corner in 3D is calculated based on the camera poses and the corners of the aruco maker.Based on the positions of the corners of the square aruco marker, the size of the marker in the unscaled reconstruction can be determined. With the correct metric size of the marker, the scene can be scaled true to scale using aruco_scale_factor.apply(true_scale).

from aruco_estimator.aruco_scale_factor import ArucoScaleFactor
from aruco_estimator.visualization import ArucoVisualization
from aruco_estimator import download
from colmap_wrapper.colmap import COLMAPProject
import os
import open3d as o3d

# Download example dataset. Door dataset is roughly 200 MB
dataset = download.Dataset()
dataset.download_door_dataset()

# Load Colmap project folder
project = COLMAPProject(project_path='../data/door', image_resize=0.4)

# Init & run pose estimation of corners in 3D & estimate mean L2 distance between the four aruco corners
aruco_scale_factor = ArucoScaleFactor(photogrammetry_software=project, aruco_size=dataset.scale)
aruco_distance = aruco_scale_factor.run()
print('Size of the unscaled aruco markers: ', aruco_distance)

# Calculate scaling factor, apply it to the scene and save scaled point cloud
dense, scale_factor = aruco_scale_factor.apply() 
print('Point cloud and poses are scaled by: ', scale_factor)
print('Size of the scaled (true to scale) aruco markers in meters: ', aruco_distance * scale_factor)

# Visualization of the scene and rays 
vis = ArucoVisualization(aruco_colmap=aruco_scale_factor)
vis.visualization(frustum_scale=0.7, point_size=0.1)

# Write Data
aruco_scale_factor.write_data()

Source

If you want to install the repo from source make sure that conda is installed. Afterwards clone this repository, give the bash file executable rights and install the conda env:

git clone https://github.com/meyerls/aruco-estimator.git
cd aruco-estimator
chmod u+x init_env.sh
./init_env.sh

Finally install all python dependencies in the activated conda environment via

pip install -r requirements.txt

To test the code on your local machine try the example project by using:

python scale_estimator.py --test_data

Limitation / Improvements

  • Up to now only SIMPLE_RADIAL and PINHOLE camera models are supported. Extend all models
  • Install CLI Tool vi PyPi
  • Up to now only one aruco marker per scene can be detected. Multiple aruco marker could improve the scale estimation
  • Different aruco marker settings and marker types should be investigated for different scenarios to make it either more robust to false detections
  • Geo referencing of aruco markers with earth coordinate system using GPS or RTK
  • Only COLMAP is supported. Add additional reconstruction software.

Acknowledgement

  • The Code to read out the binary COLMAP data is partly borrowed from the repo COLMAP Utility Scripts by uzh-rpg.
  • The visualization of the wooden block is created from the dataset found in [1]

Trouble Shooting

  • In some cases cv2 does not detect the aruco marker module. Reinstalling opencv-python and opencv-python-python might help Source

References

[1] Erich, F., Bourreau, B., Neural Scanning: Rendering and determining geometry of household objects using Neural Radiance Fields Link. 2022

Citation

Please cite this paper, if this work helps you with your research:

@InProceedings{ ,
  author="H",
  title="",
  booktitle="",
  year="",
  pages="",
  isbn=""
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aruco-estimator-1.1.7.tar.gz (16.9 kB view hashes)

Uploaded Source

Built Distribution

aruco_estimator-1.1.7-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page