GithubHelp home page GithubHelp logo

sunguwei / cubic2equi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rayryeng/cubic2equi

0.0 2.0 0.0 744 KB

MATLAB script that converts cubic images into an equirectangular representation

License: MIT License

MATLAB 94.15% M 5.85%

cubic2equi's Introduction

cubic2equi

This is a MATLAB script that converts cubic images into an equirectangular representation.

Author: Ray Phan ([email protected])

Introduction

This is a simple MATLAB script that takes a cubic representation of a scene that is provided as 6 cubic images and transform them into an equirectangular image. Some good theory on the subject can be found on Paul Bourke's webpage and can be found here.

Given 6 images of size n x n, the output image will be of size 2n x n, where 2n is the width and n is the height of the image.

It should be noted that this code does not perform any interpolation when sampling the cubic faces. This performs nearest neighbour sampling instead. You are certainly welcome to implement this on your own if you would like!

Sources of inspiration

This code would have not been made possible without the following sources:

  1. This stackoverflow post - http://stackoverflow.com/questions/11504584/cubic-to-equirectangular-projection-algorithm
  2. Paul Bourke's webpage (see above)
  3. The OpenGL 4.1 specification - Chapter 3.8.10 - http://www.opengl.org/registry/doc/glspec41.core.20100725.pdf

Requires

Any version of MATLAB with the Image Processing Toolbox installed. Alternatively, this should be Octave friendly so you can use that environment if you like.

How to run the code

Assuming that you already have 6 cubic images loaded in, which are denoted as top, bottom, left, right, front and back, you would run the MATLAB script this way:

outIm = cubic2equi(top, bottom, left, right, front, back);

However, if you are in doubt, I have included a sample test script so you can run it and see what the results are.

Assumptions

No error checking is involved with this code. This assumes that all cubic images are of the same size n x n and that the images are in colour. Should you require a monochromatic version of the code, simply comment out those lines of code that require access to more than one channel.

What is included in this repository

  1. The cubic-to-equirectangular conversion script
  2. An example script that you can use to see the script in action
  3. An example set of 6 cubic images (pulled from Paul Bourke's webpage)

License

This code is protected under the MIT License. You may feel free to use the code in any way, shape, or form and can modify it to your heart's content. You may also include the code in any applications that you develop without releasing any of your code publicly (as per the GPL). The only thing I request is that you cite where the source came from and give me credit whenever you decide to use it. Thanks!

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.