Coder Social home page Coder Social logo

exp-time-series-tools / polartransform Goto Github PK

View Code? Open in Web Editor NEW

This project forked from addisonelliott/polartransform

0.0 1.0 0.0 32.44 MB

Python package that converts between polar and cartesian domain (in images too).

Home Page: http://polartransform.readthedocs.io

License: MIT License

Python 100.00%

polartransform's Introduction

Build Status Python version PyPi version Documentation Status

Introduction

polarTransform is a Python package for converting images between the polar and Cartesian domain. It contains many features such as specifying the start/stop radius and angle, interpolation order (bicubic, linear, nearest, etc), and much more.

Installing

Prerequisites

  • Python 3
  • Dependencies:
    • numpy
    • scipy
    • scikit-image

Installing polarTransform

polarTransform is currently available on PyPi. The simplest way to install alone is using pip at a command line:

pip install polarTransform

which installs the latest release. To install the latest code from the repository (usually stable, but may have undocumented changes or bugs):

pip install git+https://github.com/addisonElliott/polarTransform.git

For developers, you can clone the polarTransform repository and run the setup.py file. Use the following commands to get a copy from GitHub and install all dependencies:

git clone pip install git+https://github.com/addisonElliott/polarTransform.git
cd polarTransform
pip install .

or, for the last line, instead use:

pip install -e .

to install in 'develop' or 'editable' mode, where changes can be made to the local working code and Python will use the updated polarTransform code.

Test and coverage

Run the following command in the base directory to run the tests:

python -m unittest discover -v polarTransform/tests

Example

Input image:

Cartesian image

import polarTransform
import matplotlib.pyplot as plt
import imageio

verticalLinesImage = imageio.imread('IMAGE_PATH_HERE')

polarImage, ptSettings = polarTransform.convertToPolarImage(verticalLinesImage, initialRadius=30,
                                                            finalRadius=100, initialAngle=2 / 4 * np.pi,
                                                            finalAngle=5 / 4 * np.pi)

cartesianImage = ptSettings.convertToCartesianImage(polarImage)

plt.figure()
plt.imshow(polarImage, origin='lower')

plt.figure()
plt.imshow(cartesianImage, origin='lower')

The result is a polar domain image with a specified initial and final radius and angle:

Polar image

Converting back to the cartesian image results in only a slice of the original image to be shown because the initial and final radius and angle were specified:

Cartesian image

Next Steps

To learn more about polarTransform, see the documentation.

License

polarTransform has an MIT-based license.

polartransform's People

Contributors

addisonelliott avatar scott-trinkle avatar

Watchers

James Cloos avatar

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.