GithubHelp home page GithubHelp logo

epth / qimage2ndarray Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hmeine/qimage2ndarray

0.0 1.0 0.0 508 KB

qimage2ndarray is a small python extension for quickly converting between QImages and numpy.ndarrays (in both directions).

License: BSD 3-Clause "New" or "Revised" License

C++ 2.87% Python 97.13%

qimage2ndarray's Introduction

qimage2ndarray

qimage2ndarray is a small python extension for quickly converting between QImages and numpy.ndarrays (in both directions). These are very common tasks when programming e.g. scientific visualizations in Python using PyQt4 as the GUI library.

  • Supports conversion of scalar and RGB data, with arbitrary dtypes and memory layout, with and without alpha channels, into QImages (e.g. for display or saving using Qt).

  • qimage2ndarray makes it possible to create ndarrays that are views into a given QImage's memory.

    This allows for very efficient data handling and makes it possible to modify Qt image data in-place (e.g. for brightness/gamma or alpha mask modifications).

  • qimage2ndarray is stable and unit-tested:

    • proper reference counting even with views (ndarray.base points to the underlying QImage)
    • handles non-standard widths and respects QImage's 32-bit row alignment
  • Masked arrays are also supported and are converted into QImages with transparent pixels.

  • Supports recarrays (and comes with an appropriate dtype) for convenient access to RGB(A) channels.

  • Supports value scaling / normalization to 0..255 for convenient display of arbitrary NumPy arrays.

  • Recent additions are convenient image loading / saving methods

Code

The extension is open source, BSD-licensed, and the repository can be browsed online or cloned using Git:

git clone https://github.com/hmeine/qimage2ndarray.git

Documentation

Documentation can be found in the doc/ subdirectory or on GitHub:

http://hmeine.github.io/qimage2ndarray

Contributors

This package is written and maintained by Hans Meine <[email protected]>.

I am grateful for feedback from Ullrich Köthe, PowerPC/endianness testing by Helge Kreutzmann and initial PyQt5 support by Rudolf Höfler.

qimage2ndarray's People

Contributors

hmeine avatar ukoethe avatar jakirkham avatar robbmcleod avatar rhoef avatar groakat 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.