Giter Club home page Giter Club logo

camera.py's Introduction

Python Projective Camera Model

Features

  • camera intrinsic and extrinsic parameters handling
  • various lens distortion models
  • model persistence
  • projection of camera coordinates to an image
  • conversion of image coordinates on a plane to camera coordinates
  • visibility handling

Installation

pip install git+https://github.com/smidm/camera.py.git

Usage

Setup camera and project point [0, 0, 0]:

import camera
import numpy as np
import math
c = camera.Camera()
c.set_K_elements(1225.0, math.pi / 2, 1, 480, 384)
R = np.array(
    [[-0.9316877145365, -0.3608289515885, 0.002545329627547],
     [-0.1725273110187, 0.4247524018287, -0.8888909933995],
     [0.3296724908378, -0.8263880720441, -0.4579894432589]])
c.set_R(R)
c.set_t(np.array([[-1.365061486465], [3.431608806127], [17.74182159488]]))

print c.world_to_image(np.array([[0., 0., 0.]]).T)

Load camera parameters from a file:

import camera
import numpy as np
c = camera.Camera()
c.load('camera_01.yaml')
c.world_to_image(np.array([[0., 0., 0.]]).T)

Documentation

http://python-projective-camera-model.readthedocs.io

Development

To test the package run:

$ ./run_tests.sh

The module is missing some (essential) functionality (search for TODO comments). I appreciate pull requests that fill the gaps.

License

MIT

camera.py's People

Contributors

smidm avatar

Forkers

tyommik

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.