GithubHelp home page GithubHelp logo

colorcorrect's Introduction

colorcorrect
by Shunsuke Aihara - http://argmax.jp

date::

    February 2012

description::

    Imprement some of color correction algorithms

require::

    python2.6 or later
    numpy
    Pillow

install::

    % python setup.py build
    % python setup.py install

impement algorithms::

    gray world
         colorcorrect.algorithm.gray_world
         usage: image
    max white
        colorcorrect.algorithm.max_white
        usage: image
    stretch
        colorcorrect.algorithm.stretch
        usage: image
    retinex
        colorcorrect.algorithm.retinex
        usage: image
    retinex with adjust
            colorcorrect.algorithm.retinex_with_adjust
            usage: image
    standard deviation weighted grey world
             colorcorrect.algorithm.standard_deviation_weighted_grey_world
             usage: image,subblock width(default:20), subblock height(default:20)
    standard deviation and luminance weighted gray world
             colorcorrect.algorithm.standard_deviation_and_luminance_weighted_gray_world
             usage: image,subblock width(default:20), subblock height(default:20)
    luminance weighted gray world
              colorcorrect.algorithm.luminance_weighted_gray_world
             usage: image,subblock width(default:20), subblock height(default:20)
    automatic color equalization
              colorcorrect.algorithm.automatic_color_equalization
              usage: image,slope(default:10),limit(default:1000)

sample usage::

    >>> import Image
    >>> import colorcorrect.algorithm as cca
    >>> from colorcorrect.util import from_pil, to_pil
    >>> img = Image.open('/path/to/image')
    >>> to_pil(cca.stretch(from_pil(img))).show()

References::

    Denis. Nikitenko, M. Wirth and K. Trudel, "Applicability Of White-Balancing Algorithms to Restoring Faded Colour Slides: An Empirical Evaluation.", Journal of Multimedia, vol. 3, no. 5, 2008.
    HK. Lam, OC. Au and CW. Wong, "Automatic white balancing using luminance component and standard deviation of RGB components", in Proc. ICASSP, 2004.
    A. Rizzi, C. Gatta and D. Marini, "A new algorithm for unsupervised global and local color correction.", Pattern Recognition Letters, vol. 24, no. 11, 2003.

colorcorrect's People

Contributors

shunsukeaihara avatar todicus avatar xiangze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

colorcorrect's Issues

Can't be installed on a Windows Machine

When you try to install this library through pip in a windows machine I get the error:

LINK : fatal error LNK1181: cannot open input file 'm.lib'

If you look in this link, you'll see that the math library is provided by a different library in windows:

>>> from ctypes.util import find_library
>>> find_library('m')
'msvcr90.dll'

I suggest changing the setup.py to this:

# -*- coding: utf-8 -*-
from setuptools import setup, Extension
import sys
import os

sys.path.append('./src')
sys.path.append('./test')
version = open('VERSION').read().strip()

libs = []
if os.name == 'posix':
    libs.append('m')

setup(name='colorcorrect',
      version=version,
      description="imprement some of color correction algorithms",
      long_description=open('README').read(),
      classifiers=[],
      keywords=('image-processing computer-vision'),
      author='Shunsuke Aihara',
      author_email='[email protected]',
      url='http://www.bitbucket.org/aihara/colorcorrect',
      license='MIT License',
      package_dir={'': 'src'},
      packages=['colorcorrect'],
      ext_modules=[
          Extension(
              'colorcorrect._cutil', [
                  'cutil/cutil.cpp',
              ],
              include_dirs=['cutil'],
              libraries=libs,
              extra_compile_args=[],
          ),
      ],
      install_requires=["numpy", "Pillow", "six"],
      test_requires=["nose"]
      )

float interpreted as int fails in lib.stride_tricks.as_strided()

hello shunsukeaihara
In using your code outside the python setup, - ie, githubbed and called from my code with python 3.6.4 and numpy 1.14.0. on Ubuntu 16.04

In running standard_deviation_weighted_grey_world_python() I had to change the following line to make the call to lib.stride_tricks.as_strided() work

from>
shape = (height / subheight, width / subwidth, subheight, subwidth, 3)
to>
shape = (int(height / subheight), int(width / subwidth), subheight, subwidth, 3)
fyi

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.