2

Basically I'm trying to create a printer which print colours using 3 cartridges as base colours; let's call them A,B and C.

Machine operating: The machine mix an amount of each cartridge to get a new color (the sum of all the amounts should be 100). This new color can be seen as an RGB value.

The question is: How can I get the percentage of each base colour (the amount of each cartridge) from an RGB value to mix that colour? It doesn't matter if the percentage is not exact.

I created a table with some examples of the machine operation, the base colours are highlighted (This table doesn't contains the real examples, it's just for explanation).

Thanks in Advance.

enter image description here

  • The table above was only for explain the whole structure. So basically I'm trying to simulate how a printer works, I have 3 customs cartridges and I need to print a custom colour, for example a red image, and don't know which percentage of each colour I need to set up for matching the red image. That makes sense? – Jonathan Benavides Sep 22 '15 at 13:11
  • @JanneKarila Maybe that should work but don't know how to set up the equations properly. – Jonathan Benavides Sep 22 '15 at 13:34
  • @JanneKarila I would rather go *Curve Fitting* – A.S.H Sep 22 '15 at 13:48
  • @A.S.H Curve Fitting looks really useful. Would you mind to explain a bit more about it? Thanks. – Jonathan Benavides Sep 22 '15 at 14:02
  • say A is a linear combination of Red, Green and Blue. You have many sample points, so you fit your best fit line using the *Least Square* method. You apply the same for B and C. You might also find that a second order polynomial might better fit your data, it needs some investigation. – A.S.H Sep 22 '15 at 14:06

3 Answers3

1

Have you ever tried FANN ?

you can train a network giving 3 inputs as training data and then execute it on your work. It supports more than 20 programming languages so I think it will be easy to integrate ;)

Rafael Ruiz Muñoz
  • 5,333
  • 6
  • 46
  • 92
0

If I understand the question correctly ...

Split each RGB colour into components. R is a component. G is a component. B is a component.

Now you just have to add the 3 red components to get their maximum value; you now multiply by 100 and divide by 255; this should give you the percentage for the red component. Same about green component and blue component.

Well, that's for the "getting the percentage of a base colour" part. Making the sum become 100% is just a matter of dividing 300 by the sum of the 3 individual percentages (this can of course be shortened by dividing 3*255 by the sum of the individual components), then multiplying each component-percentage or each component by that value.

0

Thank you very much to everyone.

I finally ended up using FANN neural network http://leenissen.dk

Using fann_cascadetrain_on_data, with 3 inputs (R-G-B), 3 outputs (A,B,C) and using the set of examples as training data.

Thanks.