2015-01-25, 20:41

I'm proud to present ColourSum - a tool for calculate the sum of two hex RGB colours with integrated comparison to LDraw standard colours.

Just remove the .ldr extension ;-)

/Max

Just remove the .ldr extension ;-)

/Max

You're currently viewing a stripped down version of our content. View the full version with proper formatting.

2015-01-25, 20:41

I'm proud to present ColourSum - a tool for calculate the sum of two hex RGB colours with integrated comparison to LDraw standard colours.

Just remove the .ldr extension ;-)

/Max

Just remove the .ldr extension ;-)

/Max

2015-01-26, 8:02

Great! And as a by-product, it also gives the closest LDraw color of any RGB value (just enter it in both colors 1 and 2).

What distance do you use? RGB one? Might be interesting to convert RGB color to HSL (see discussion here http://stackoverflow.com/questions/16784...98#1678498).

What about showing color samples for both initial values?

What distance do you use? RGB one? Might be interesting to convert RGB color to HSL (see discussion here http://stackoverflow.com/questions/16784...98#1678498).

What about showing color samples for both initial values?

2015-01-26, 9:27

Yes, I'll try to add an option to pick a colour on the screen and find the nearest LDraw-Colour of it...

Actually the program calculates all distances sqrt((r_1-r_2)^2+(g_1-g_2)^2+(b_1-b-2)^2) between the new calculated colour and the LDraw Colours, looks for the minimum of this distances and compare this minimum with the distance array to find the corresponding colour.

I can try to implement an HSL in/output as well.

Yes, the colour samples for the input values are on my todo list. But then I have to move the 'error check' (6 values, 0-f) must be done while the textbox changes its value or while leaving it. I'll think about. :-)

/Max

PS.: Please note, that my programming skills are a bit limited, so that I have to read several pages to get to the right path. :-)

PPS.: I think I'll remove the sqrt. So I can calculate with integers and don't need to convert to double. The result should be the same.

Actually the program calculates all distances sqrt((r_1-r_2)^2+(g_1-g_2)^2+(b_1-b-2)^2) between the new calculated colour and the LDraw Colours, looks for the minimum of this distances and compare this minimum with the distance array to find the corresponding colour.

I can try to implement an HSL in/output as well.

Yes, the colour samples for the input values are on my todo list. But then I have to move the 'error check' (6 values, 0-f) must be done while the textbox changes its value or while leaving it. I'll think about. :-)

/Max

PS.: Please note, that my programming skills are a bit limited, so that I have to read several pages to get to the right path. :-)

PPS.: I think I'll remove the sqrt. So I can calculate with integers and don't need to convert to double. The result should be the same.

2015-01-26, 12:10

A few interesting links sent by a friend: http://www.easyrgb.com/index.php?X=MATH including a converter http://www.easyrgb.com/index.php?X=CALC

And http://en.wikipedia.org/wiki/Color_difference

Good luck

And http://en.wikipedia.org/wiki/Color_difference

Good luck

2015-01-26, 14:52

Just to add some complexity

Take a look to the source of my quick&dirty mosaic app, BrickMosaic.

In file "BrickColors.java" there are some references to XYZ and CIE-Lab colorspaces and CIE1994 method to measure "visual distance" between two color.

I tried some algorithm and colorspaces, but CIE-Lab + CIE1994 giving best results.

In source (file BrickColors.java):

- conversion from RGB to CIE-Lab is in function "RGB2Lab"

- color distance CIE1994 is computed in function "colorDiff_DE1994"

- I used a Java library function to convert a color from RGB to XYZ colorspace, but in source there is a commented function (RGB2XYZ) that do the same.

HTH

Mario

Take a look to the source of my quick&dirty mosaic app, BrickMosaic.

In file "BrickColors.java" there are some references to XYZ and CIE-Lab colorspaces and CIE1994 method to measure "visual distance" between two color.

I tried some algorithm and colorspaces, but CIE-Lab + CIE1994 giving best results.

In source (file BrickColors.java):

- conversion from RGB to CIE-Lab is in function "RGB2Lab"

- color distance CIE1994 is computed in function "colorDiff_DE1994"

- I used a Java library function to convert a color from RGB to XYZ colorspace, but in source there is a commented function (RGB2XYZ) that do the same.

HTH

Mario

Powered By MyBB, © 2002-2023 MyBB Group