Giter Site home page Giter Site logo

image-color-transfer's Introduction

Image color transfer

This Python program implements a color transfer algorithm that takes as input two images, a source image and a target image, and applies the color distribution of the source image to the target image. The program uses the OpenCV library to perform color space conversion and manipulation.

Description

Lab color space

The Lab* (or LAB) color space is used in this color transfer algorithm as it provides a perceptually uniform color space, meaning that the distances between colors in this space correspond to human perception of color differences. The Lab* color space separates the color information into three channels: L (lightness), a (green-red axis), and b (blue-yellow axis).

Working

The color transfer algorithm works by computing the mean and standard deviation of the color channels in the LAB color space for both the source and target images. Then, it adjusts the color channels of the target image to match the mean and standard deviation of the corresponding channels in the source image. Finally, the program converts the resulting image back to the BGR color space and saves it to a file.

graph TD;
    A[Load source image] --> B[Convert to LAB color space]
    C[Load target image] --> D[Convert to LAB color space]
    B -- Calculate mean and standard deviation --> E[Adjust target channels]
    E -- Convert back to BGR color space --> F[Save result image]
    D -- Calculate mean and standard deviation --> E
    A --> F
    C --> F

Getting Started

Dependencies

  • Dependencies are listed in requirements.txt

Executing program

  • Clone this repository
git clone https://github.com/Anant-mishra1729/Color-transfer.git
  • Run python file color_transfer.py
python color_transfer.py 

--source or -s : Path to source image (Image to be used for transferring color)

--target or -t : Path to target image (Image on which color is transferred)

--result or -r : Path to resulting image

Results

Source : Google images

Source Target Result

Contributors

Anant Mishra

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Color Transfer between images

image-color-transfer's People

Contributors

anant-mishra1729 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

itcd

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.