Skip to content Skip to sidebar Skip to footer

Get Quantitative Value For Color On Two-color Scale

I have run a chemical test that produces a color depending on how much of a given chemical is in the sample. It is green if there is no chemical, and yellow if there is a saturatin

Solution 1:

  1. create table/function RGB = f(concentration)

    It is the opposite of what you want to do. The idea is to convert some continuous scalar variable (concentration) to RGB color (with some physical meaning). Here some examples of mine for this:

  2. Camera calibration

    As Mark Ransom suggested this step is necessary. I would try to place some markers in the view area to help with this. For example something like:

    markers

    Now pick the colors in the corner markers, compute how match they differ to your marker real colors and interpolate the whole image bilinear-ly. If you need bi-cubic (much better results) then use 16 markers. This process is very similar to this:

    You will need to experiment what markers to use (just black&white, or just green&yellow or black&red&green&blue or combinations ...) so your results will keep the same for varying light conditions. Also you have to make the dependency shots you will base the #1 on again with markers because without them you could have errors in results ...

    Calibration step can be avoided only if your camera is pre-calibrated, the indicator is always the same color,material,roughness,shininess,... and the image is taken with uniformly constant illumination conditions (inside some box,same bulbs,same exposition,same pupil...) without any shadows,spots,etc... Setups like that are very expensive. The low cost hand held devices are around $10000 USD (usually used for color detection/testing in manufacturing to calibrate machines).

  3. conversion concentration = f(RGB)

    If the dependency in #1 is some kind of simple function then you can make its inverse algebraically and use it directly. If you construct the RGB diagrams as in the linked QA's you will see which channel(s) to use as input (sometimes you need just one).

    If the dependency is too complicated or not a function then you can use:

    In case the dependency is strictly non-increasing or non-decreasing you can also use binary-search for this.


Post a Comment for "Get Quantitative Value For Color On Two-color Scale"