tompazourek / colourful Goto Github PK
View Code? Open in Web Editor NEW๐จ Open source .NET library for working with color spaces.
License: MIT License
๐จ Open source .NET library for working with color spaces.
License: MIT License
Hello,
This isn't a question about Colourful; I am trying to understand some code I have inherited that does conversion from CIELab to RGB after decompressing an JPEG 2000 file. I don't know a lot about colour spaces or colour conversions.
If you have a moment, I'm trying to grok the color_cielab_to_rgb
method in
this file:
https://github.com/GrokImageCompression/grok/blob/master/src/bin/common/color.cpp
I am trying to understand the code
if(default_type == 0x44454600) { /* DEF : default */
rl = 100;
ra = 170;
rb = 200;
ol = 0;
oa = pow(2, prec1 - 1);
ob = pow(2, prec2 - 2) + pow(2, prec2 - 3);
} else {
rl = row[2];
ra = row[4];
rb = row[6];
ol = row[3];
oa = row[5];
ob = row[7];
}
Is the code in the else branch a custom CIELab space, and the code above is based on a standard CIELab space ?
If you have time, interested in knowing your take on this.
Thanks,
Aaron
CIECAM02 might have some nice features that might be useful for the Colourful library.
Some Java implementation:
https://github.com/igd-geo/pcolor
http://painterly.costar.sfu.ca/
Other links:
http://en.wikipedia.org/wiki/CIECAM02#Chromatic_adaptation
http://www.cis.rit.edu/fairchild/PDFs/AppearanceLec.pdf
Parse according to CSS 3 standard:
Could be done by converter factory maybe.
Maybe I'm doing something wrong, but when I try a basic RGB -> Lab conversion I'm getting a different answer than other converters out there.
var c1 = Color.FromArgb(0, 255, 0);
var c2 = new RGBColor(c1);
var converter = new ColourfulConverter();
var c4 = converter.ToLab(c2);
This gives me Lab [L=87.82, a=-79.29, b=80.99]
But when I try the same conversion on http://colormine.org/convert/rgb-to-lab I get: L = 87.74, a = -86.18, b = 83.18.
Any idea what I'm doing wrong here?
Thanks,
Mike
http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/
(archive: http://web.archive.org/web/20131211145340/http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/ )
Also interesting seems gamma-adjusted RGB blending.
The color spaces should accept Vector as a constructor, since many blending modes can be universal and applied on color vectors.
Implement these factory methods for convenient use:
let rgb = Colourful.RGBColor systemColor
let cnvrtr = Colourful.Conversion.ColourfulConverter()
let lab = cnvrtr.ToLab rgb
same code works fine with v1.2.2
ColorConverter
class name directly conflicts with System.Drawing.ColorConverter
. It might be better to change its name for easier integration.
Implement ToString()
RGBColor currently enforces values to be 0..1. I would like to work with colors that are outside of the sRGB color gamut but still valid.
Is there a way to do that?
var defaultColor= default(LinearRGBColor);
var converter = new ColourfulConverter();
var actual = converter.Adapt(defaultColor);
Produces an NRE. This also happens with arrays of LinearRGBColor.
Same as RGB, but not using companding on the channels.
Hello,
If you take RGB values (Let's say sRGB) and convert to LAB with D50, do you get exact values like in Photoshop?
Thank You.
I use the latest version 2.0.3 in .NETFramework 4.7.2, when convert XYZColor to RGBColor throw an StackOverflowException exception. The exception message 'System.StackOverflowException was unhandled Message: An unhandled exception of type 'System.StackOverflowException' occurred in Colourful.dll'.
Test code:
// arange
var input = new XYZColor(0.96422, 1.00000, 0.82521);
var converter = new ColourfulConverter { WhitePoint = Illuminants.D50, TargetRGBWorkingSpace = RGBWorkingSpaces.sRGB };
// act
var output = converter.ToRGB(input);
Any chance that the code could be down-ported back to .NET 4.6? Unity requires at most .NET 4.6 and this code utilizes .NET 7 functions like "type pattern matching".
The 'in' and 'readonly' keyword can be left out, "get=>" can easily be rewritten and a throw after a double questionmark is easily fixed, but "type pattern matching" needs some rework.
Maybe add unity support in a separate branch? Would you accept a pull request?I could add some extra's to calculate averages from textures etc...
It would be useful to add the Jzazbz color space . Thank you
Replace the dependencies on Math.NET by custom built-in utility classes.
Hello,
I am trying to get the converter working with VB.net but I can't for the life of me figure out what is to go in the new constructor of the ColourfulConverter? Anyone that could help. When I run it like this I get the following error: System.ArgumentOutOfRangeException: 'The maximum value is 1'
Dim input As RGBColor = New RGBColor(Px.R, Px.G, Px.B)
Dim LAB As LabColor
Dim conver = New ColourfulConverter()
LAB = conver.ToLab(input)
Hi there,
Thanks a lot for working on this project. I am trying to process video frames from a Rec2020 ST2084 video file and plot a brightness waveform (Y axis is nits) like I am used to seeing in DaVinci Resolve.
Do you have any end to end example of using your library to access individual frames from a video file?
Thanks!
Nice test data can be obtained from this Java applet:
http://www.brucelindbloom.com/index.html?ColorCheckerCalculator.html
There are values from all supported color spaces, this can properly test the conversion.
For some reason, NuGet contains only DLL and XML docs.
It should contain PDB for better debugging/exception experience.
Maybe we could also consider Source Link?
One of the features that require .NET 4.5 are IReadOnlyList
vectors and matrices. These might be substituted with IList
or arrays for older .NET versions. Of course, there might also be more problems.
Sorry for this newbie question but;
Is it possible to get the RGB Result in 0-255?
Thanks Lars
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.