GithubHelp home page GithubHelp logo

happy-ferret / temperature Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maruel/temperature

0.0 2.0 0.0 12 KB

Converts between color temperature in Kelvin and in RGB (Golang)

License: MIT License

Go 100.00%

temperature's Introduction

temperature

package temperature implements an algorithm to calculate the channel intensity for a color temperature.

GoDoc

Explanation

Color Temperature is the color due to black body radiation at a given temperature. The temperature is given in Kelvin. The concept is widely used in photography and in tools such as f.lux.

The function here converts a given color temperature into a near equivalent in the RGB colorspace. The function is based on a curve fit on standard sparse set of Kelvin to RGB mappings with a whitepoint (255, 255, 255) at 6500K.

NOTE The approximations used are suitable for photo-manipulation and other non-critical uses. They are not suitable for medical or other high accuracy use cases.

Accuracy is best between 1000K and 30000K.

History

This project has been implemented specifically for the use case of APA-102 LEDs, driven by a Raspberry Pi, which are very cold by default. Then he reimplemented it in C++ with integer only arithmetic to run on a ESP8266.

Performance

Benchmark run on a Intel i7-5600U:

BenchmarkToRGBUsingTH1500-4     30000000                42.8 ns/op
BenchmarkToRGBUsingTH2500-4     30000000                56.8 ns/op
BenchmarkToRGBUsingTH6500-4     1000000000               2.35 ns/op
BenchmarkToRGBUsingTH7000-4     10000000               195 ns/op
BenchmarkToRGB1500-4            30000000                43.8 ns/op
BenchmarkToRGB2500-4            30000000                57.5 ns/op
BenchmarkToRGB6500-4            1000000000               2.34 ns/op
BenchmarkToRGB7000-4            30000000                57.8 ns/op

License

License is MIT.

temperature's People

Contributors

maruel avatar

Watchers

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