Code Monkey home page Code Monkey logo

fisheye_window's Introduction

Fisheye Window

Thanks to the study

This is snippet program implements dewarped image extraction algorithm exactly as presented in this research paper:

"High Quality Image Correction Algorithm With Cubic Interpolation for Fish-eye Lens" by Mori Takahiro et al.

CAUTION: Main part of this paper - high quality image correction - is not handled here.

This snippet is...

There are many information found on Web regarding getting panorama image from fisheye image, but these are limited to show off each technique. My snippet shows exact code for getting image from your fisheye source image freely regarding:

  • Angle
  • Zooming

You can get images as if you are shitting in the center of fisheye image, and looking around. I call this as "window" of the fisheye image, so the class name is FishEyeWindow. Let's see what you can get below.

Sample

Source FishEye image

Source

Sample Results

Center
Center Center Center
Center

Parameters

Angle Parameter
left alpha=-270.000000, beta=135.000000, theta=270.000000, zoom=0.300000
center alpha=-270.000000, beta=0.000000, theta=270.000000, zoom=0.300000
right alpha=-270.000000, beta=-135.000000, theta=270.000000, zoom=0.300000
up alpha=0.000000, beta=90.000000, theta=0.000000, zoom=0.300000
down alpha=0.000000, beta=-90.000000, theta=0.000000, zoom=0.300000

How to use

Once you start python snippet like this:

$ python fisheye360.py sample.png

Program will stay running waiting for your control.

Hit followings to move your view:
  'r' or 'f' to zoom
  'g' or 't' to rotate alpha
  'h' or 'y' to rotate beta
  'j' or 'u' to rotate theta
  's' to save current view to ./result.png

Hit ESC to exit.

Requirements

Opencv 2.x would be ok, or try 3.x if you see anything wrong.

Design detail

The FishEyeWindow class is designed based on:

  • The center of source image is the center.
  • Top/bottom or left/right part of image can be cut, as long as the center is the center.
  • Small workaround done for hiding an issue - orthant exchange; explained below.

Regarding orthant issue

If I follow simply as the original math, the result image has problem:

  • What should be on the orthant I is on the II, and the II on the I.
  • Tha same thing for III and IV.

Then I implemented simple workraound to exchange orthant as you can find in the source.

No copyright, no license

This is just have interpreted math equations into python code, feel free to use.

fisheye_window's People

Contributors

daisukelab avatar blmd-niz avatar

Forkers

sbgisen

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.