https://github.com/chris10m/ocam_python

ocamcalib_python: omnidirectional project points

https://github.com/chris10m/ocam_python

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: springer.com
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

ocamcalib_python: omnidirectional project points

Basic Info
  • Host: GitHub
  • Owner: Chris10M
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 30.3 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created almost 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

ocam

ocam: omnidirectional project points

A torch, numpy, MATLAB for python, and python implementation of the projection functions of Scaramuzza's Omnidirectional Camera.

Installation

Clone the repository and install git clone https://github.com/Chris10M/ocamcalib_python.git cd ocamcalib_python python -m pip install .

Optional Dependacies

The conversion scripts for MATLAB intrinsics to JSON intrinsics and JSON to MATLAB intrinsics require MATLAB and MATLAB Engine API for Python.

Tested with MATLAB R2023a

Usage

Command Line

convert_intrinsics_to_matlab_fisheye path/to/fisheye_intrincis.json # output: path/to/fisheye_intrincis.mat convert_matlab_to_intrincis_fisheye path/to/fisheye_intrincis.mat # output: path/to/fisheye_intrincis.json

The fisheye_intrincis.mat can be obtained by following the instructions here or using the Camera Calibration App. I would recommend going with the latter as it is very easy.

Minimal usage script

``` import ocam import numpy as np

Specify the path to the camera calibration JSON file

ocamcalibjson = 'intrinsics.json'

Load the camera calibration model from the JSON file

ocamcalibmodel = ocam.toocammodel(ocamcalibjson)

Generate random 3D points (replace this with your actual 3D points)

numpoints = 10 # Number of 3D points points3D = np.random.rand(numpoints, 1, 3) # Random 3D points with x, y, z coordinates - Nx1x3

Project the 3D points into 2D points using the camera calibration parameters

points2D = ocam.world2camnp(points3D, ocamcalib_model) # points2D - Nx1x2

Print the resulting 2D points

print("Projected 2D points:") print(points2D) ```

The intrinsics.json has the following format, { "pol": [161.14670546203945, 0, -0.00258314253679925, 6.035124622290237e-06, -2.5573236046748687e-08], "width": 640, "height": 480, "xc": 321.3651091048847, "yc": 236.25516320600983, "c": 1.0, "d": 0.0, "e": 0.0, "shift_cx": 1.5283916846915417, "shift_cy": -4.035136165139761, "invpol": [246.60052640819538, -144.4605008632319, -6.62349373938239, -18.73714768763381, 14.831092227950778, 2.7995346430010786, 0.22537325854641585, -4.961875735767433, 1.7473552065804472] } the invpol in computed in ocam.toocammodel function.

More examples:

Check out example.py for more examples.

Citations

If you find this code useful for research, consider citing:

  • Original Omnidirectional camera publication, @article{scaramuzza2014omnidirectional, title={Omnidirectional camera}, author={Scaramuzza, Davide and Ikeuchi, Katsushi}, year={2014}, publisher={Springer US} }

Owner

  • Name: Christen Millerdurai
  • Login: Chris10M
  • Kind: user

PhD & Researcher @ AV DFKI-Kaiserslautern.

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1