Giter Site home page Giter Site logo

ang0-0gna / hololenscamcalib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qian256/hololenscamcalib

0.0 0.0 0.0 107.18 MB

Programs to calibrate HoloLens front-facing camera, supporting HL1 and HL2

License: GNU Lesser General Public License v3.0

Python 6.07% C++ 6.51% C 72.66% Objective-C 4.38% C# 10.38%

hololenscamcalib's Introduction

HoloLens Camera Calibration

Author: Long Qian

Date: 2020-04-19

Overview

This repository guides you to calibrate your HoloLens front-facing camera using OpenCV. It supports both HoloLens 1 and HoloLens 2.

The intrinsics of HoloLens front-facing camera is available with Windows UWP API, but we still want to calibrate it for various reasons. Then it is the right repository for you.

This repository contains:

  • HoloLensFrameSaver/: Unity project to capture and save images for calibration
  • OpenCVCalib/: python scripts to calibrate the camera using saved images
  • CalibFileConverter/: C++ program to convert the OpenCV calibration file to ARToolKit format
  • Examples/: Example calibration files and images for HoloLens 1 and HoloLens 2 (with my device)

How to Calibrate?

  1. Build HoloLensFrameSaver
    • Change the target resolution for the front-facing camera in Unity, available resolution profiles are listed here
    • Apply approriate settings to build the app and deploy to device
  2. Run HoloLensFrameSaver on the device
    • Soon after starting, the camera image should be displayed in the front
    • Prepare a chessboard marker for calibration, e.g. chessboard.pdf
    • Run the python script on the host PC HoloLensFrameSaver\keyboard.py with IP address of HoloLens. The script sends keyboard command to the HoloLens
    • Adjust your head position to look at the chessboard from various angles and distances. Press Space key on the keyboard to trigger HoloLens to save the image locally
  3. Download the images from the Device Portal, FileExplorer\LocalAppData\FrameSaver\RoamingState\
  4. Run the Python script in OpenCVCalib to calibrate the saved images
    • python calibrate.py --square_size 0.03 --pattern_width 7 --pattern_height 5 PATH/TO/IMAGE/*.png
    • If you used your own chessboard marker, change the arguments of the python script
    • You will find the calibration file at output\data.yaml and output\data.json
  5. (Optional) If you come from HoloLensARToolKit, you need to convert the OpenCV format calibration file to ARToolKit format. You can achieve that by using the C++ program in CalibFileConverter/.
    • Modify the parameters in ARToolKitCalibrationFileGenerator.cpp using the results of previous calibration
    • Run the program, and copy the calibration file to HoloLensARToolKit

FAQ

  1. How to I verify the binary ARToolKit calibration file?

Run the src/ARToolKitCalibrationFileGenerator/ARToolKitCalibrationFileReader.py with the specific readFileName parameter.

License

HoloLensCamCalib is open for use in compliance with GNU Lesser General Public License (LGPL v3.0). Please see COPYING and COPYING.LESSER for license details.

hololenscamcalib's People

Contributors

qian256 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.