GithubHelp home page GithubHelp logo

sigoden / node-fisheye Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 402 KB

A opencv fisheye camera model bindings for Node.js.

License: MIT License

Python 15.48% JavaScript 30.19% C++ 54.34%
opencv fisheye n-api

node-fisheye's Introduction

Fisheye camera model

A opencv fisheye camera model bindings for Node.js.

Install

install opencv 3.x

For linux

git clone https://github.com/opencv/opencv
mkdir opencv/build
cd opencv/build
cmake ..
sudo make install

For mac

brew tap homebrew/science
brew install opencv@3
brew link --force opencv@3

install npm package

npm install @sigodenjs/fisheye

Usage

Prepare checkboard

Download the checkerboard pattern and print it on a paper (letter or A4 size). You also want to attach the paper to a hard, flat surface such as a piece of cardboard. The key here: straight lines need to be straight.

Take sample photos

Hold the pattern in front of your camera and capture some images. You want to hold the pattern in different positions and angles. The key here: the patterns need to appear distorted in a different ways (so that OpenCV knows as much about your lens as possible).

demo

Find K and D

let imgs = fs
    .readdirSync('example/samples')
    .map(file => fs.readFileSync('example/samples/'+file));
let {K, D} = fisheye.calibrate(imgs, 9, 6);

Undistort image

let img = fs.readFileSync('example/samples/IMG-0.jpg');
let buf = fisheye.undistort(img, K, D);
fs.writeFileSync('/tmp/IMG-0.jpg', buf);

before --> after

License

Copyright (c) 2018 sigoden

Licensed under the MIT license.

node-fisheye's People

Contributors

sigoden avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

protofy-xyz

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.