GithubHelp home page GithubHelp logo

opencl-image-processing's Introduction

This code implements a number of image processing operations using OpenCL.

Using the map pattern, implement a OpenCL kernel to convert an image, where each pixel 
is stored with red, green and blue components (an RGB colour space) into an image 
where each pixel is stored with chromaticity (x, y) and luminance (Y).


First convert RGB into intermediate XYZ values:

X = 0.4124 * R  +  0.3576 * G  +  0.1805 * B
Y = 0.2126 * R  +  0.7152 * G  +  0.0722 * B
Z = 0.0193 * R  +  0.1192 * G  +  0.9505 * B


Second calculate xyY as:

x = X / (X + Y + Z)
y = Y / (X + Y + Z)
Y = Y

…where Y is the luminance of the given pixel.  The output of this stage will be a new 
image where each pixel is stored in the xyY colour space instead of the RGB colour space.

Second OpenCL kernel to take the resulting image from step 1 and set the luminance of each 
pixel to be 50% of its original value.

Third OpenCL kernel to convert the xyY image you modified in step 2 back into the RGB colour 
space and save the resulting image to disk.

First convert the xyY values back into intermediate XYZ values…

X = x * (Y / y)
Y = Y
Z = (1- x- y) * (Y/ y)


…then convert the intermediate XYZ values into RGB values:

R =  3.2405 * X  +  -1.5371 * Y  +  -0.4985 * Z
G = -0.9693 * X  +   1.8760 * Y  +   0.0416 * Z
B =  0.0556 * X  +  -0.2040 * Y  +   1.0572 * Z

opencl-image-processing's People

Contributors

ohowells 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.