Test Kits Using Phone RGB - Color Blind Testing Aid

OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Calcium

For the first Red Sea Pro Calcium post I used a ~6 inch distance from the phone to the vial and used the Red from the RGB as the indicator for test completion.

Here I have a back to back comparison with the vial at a distance (~6 inches away) and with the vial against the camera using the foam block.
The 6 inch distance results are compared using the RGB Red as the indicator and with the HSV Hue as a comparison. The foam block results with the vial against the camera only use the HSV Hue results.

The plot labeled "Calcium at Distance : Red" is the camera at ~6 inches using the RGB Red as the indicator. I have been using a value of Red < 50 as the test stop which would be 0.92ml. The curve passing through 50 has a slowly decreasing slope, so picking the 50 value was just a judgment call and I held it the same to be repeatable test to test.

The plot labeled "Calcium at Distance : Hue" is the camera at 6 inches using the HSV Hue as the indicator. The shape is very similar to the Red curve discussed above, and the slope at 0.92 ml is also a slow transition.

The color vial screen grabs are included. These have the vial visible in the picture. The HSV and RGV value are included in the top left and top right of the screen grabs and the tests are labeled with the amount of titrant added.

The plot labeled "Calcium in Foam Block:Hue" has the vial up against the camera in the foam block with the camera flashlight on and uses the HSV Hue as the indicator. Here the Hue curve makes a clear shift at 0.92ml which is a much clearer indicator that the previous plots. The 0.92ml give a Calcium value of 460.

The color screen grabs for the calcium show a very uniform color. The calcium test is very opaque which distributes the light uniformly with no glare spots or reflections and very little color variation. The RGB Red indicator in these plots also does a very clear transition dropping from 224 at 0.90ml to 5 at 0.92ml.

For future tests I will proceed with the foam block and HSV Hue as the indicator. I will use 240 as the Hue indicator with the test complete at the point where the Hue is less than 240. With the high slope this becomes a much more repeatable test with a very clear indicator. Switching to the foam block and using HUE made this test much easier to indicate the color change compared to what I was doing before. The uniform colors up close also make the test more repeatable.

calcium_far_red.jpg calcium_far_hue.jpg Calcium_far_1.JPG Calcium_far_2.JPG Calcium_far_3.JPG calcium_foam_hue.jpg Calcium_foam_1.JPG Calcium_foam_2.JPG Calcium_foam_3.JPG
 

taricha

5000 Club Member
View Badges
Joined
May 22, 2016
Messages
6,483
Reaction score
9,995
Rating - 0%
0   0   0
This continues to be great.
I was thinking myself about placing the color sample in a styrofoam box with most of the top covered with white paper towels to ensure super even diffused light.

I remember trying that app in the past but I couldn't remember why I went away from it. I took an overhead pictures today and then I remembered why. I attached one of my pictures. In that app you take an overhead picture, then pick a sample point on the vial, and then on the two closest colors on the card and it will interpolate your color to the neighboring colors on the card. With my lighting I get a lot of reflection from the light and a lot of shadows, light spots, and dark spots. I didn't know where to pick on my sample and if I picked different spots I could get different results
Agreed. The aquarium note app is super sensitive to light and shadows, compared to the app you are using. I was surprised when I saw how well the HSV colorspace handles shadows and bright spots.

I hope to try to use it to quantify color in Seachem Ammonia test that uses little sensitive color discs.
The issue is that the discs develop blotchy and uneven color, but I'm thinking the color selection area can be made to average over the whole area of the disc. We'll see if that helps with color interpretation.
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Magnesium

Here is the back to back for Magnesium.
First graph Magnesium test from 6 inches using RGB Red indicator "Magnesium Far Red". This always made a nice sharp transition. My target for this was Red <50 which would be 0.66ml and a Mag level of 1320.

Second graph Magnesium test from 6 inches using HSV Hue indicator "Magnesium Far Red". Again a nice sharp transition using the Hue and a steep slope for the transition.

Color screen grabs with the amount of titrant added, HSV, and RGB values are included similar to my previous tests. These are the color pictures where the vial is visible.

Next graph is using my foam phone adapter with the vial against the camera and the camera flashlight on using the HSV Hue as the indicator "Magnesium Foam Hue". Here then end transition of the color change is extremely sharp and easy to read. Like the calcium test I am going to use an end Hue target of Hue < 240 which corresponds to 0.68ml (the first point that registers below a hue of 240) for a Mag reading of 1360. This reading is one notch higher than my previous method. Again, I'm shooting for consistency.

The color screen grabs with the foam adapter show that like the calcium test the magnesium gives a nice uniform color. The color starts at pure red with an RGB of 255,0,0 and an HSV of 0,100,100. Note that in the HSV color spectrum the Hue wraps around in a circle from 0 to 360 degrees so 0 and 360 are the same value. For my graphs I used 360 as pure red rather than 0 to make the graph more continuous as the next data point has a hue of 358 then 352. Just a note on what I am dealing with being color blind the 0.66ml and 0.68ml colors look identical to me! My wife assures me they are different.

Mag_far_red.jpg Mag_far_hue.jpg Mag_far1.JPG Mag_far2.JPG Mag_foam_hue.jpg Mag_foam1.JPG Mag_foam2.JPG
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Nitrates

So I played around with some Nitrate samples yesterday. Unlike the other titration tests where you are detecting a color change, for Nitrates you need to be able to get the absolute color correct and repeatable which is more difficult with the lighting and shadows. I took some pictures from different angles to try to get an idea of the color variation. From my previous post with Nitrates with the Red Sea kit the Hue value stays fairly constant while the Saturation values varies (the second number in HSV: Hue, Saturation, Value).

The first two photos are overhead shots. I have a hard time not getting glare light spots on the bottom of the vial and there are some shadows and light spots outside of the glare. In the spots I did pick I tried to get into a solid color patch and got saturation values of 19 and 23.

Next photo is labeled "Nitrate Far" with the vial held up against my paper back drop. Here the closer pic has decent uniformity in the color while the further picture shows a little more shadow. Saturation values are 24 and 28. You could probably make this work. By eye I would put this sample pretty close to a 5 nitrate on the card. In my previous post 5 nitrate on the card had a saturation of 25. In different light I can easily get the saturation of the card to move around by 5 but this may be close enough.

The "Nitrate Foam" picture uses my foam close up adapter with the phone flashlight on. This doesn't work well at all with the Nitrate samples. The fluid is much too transparent so there are multiple glare spots, reflections, and light and dark spots. I hunted around a little with the target and had Saturation values ranging from 38 to 54. A pretty big variation. These saturation values up close were all much higher as well, although you could calibrate around this if needed.

The poor performance of the Nitrate in the foam block got me thinking about why the calcium test is so good and uniform. In the calcium test the fluid turns very opaque and cloudy and this really helps to even out the color and dull any effects from the lighting. I did some internet searching and ended up on a Wikipedia page for "Clouding agent". It mentions some different fluid additions that will turn a fluid from clear to cloudy. It mentions fruit juices so I went in the refrigerator and grabbed some lemon juice. The final picture called lemon drops shows the same nitrate sample with 0, 12, and 24 drops of lemon juice added to it. At 24 drops everything is nice and uniform and all the glare is gone, but at the expense of some color change.

I also learned that when you forget to set your phone to HSV and leave it on RGB that there are online sites that will do the translation for you. The translated HSV values for the lemon drop samples are:
0 drops: (314, 52.5, 100)
12 drops: (337, 46.6, 96.9)
24 drops: (351, 39.6, 98)
So the lemon drops shifted the sample Hue towards Red and dropped the saturation.

So short term pictures from the top or side are probably adequate to use with the curve fit I provided previously off of the red sea card. There is some variability in the saturation depending on how you take the pictures but it isn't huge.

Long term a clouding agent used with it's own calibration curve could probably create a really repeatable nitrate calibration.

Overhead1.jpg Overhead2.jpg Foam2.JPG Foam1.JPG LemonJuice.jpg LemonDrops.JPG
 

taricha

5000 Club Member
View Badges
Joined
May 22, 2016
Messages
6,483
Reaction score
9,995
Rating - 0%
0   0   0
check out this as a light diffuser for sample / color card tests.
seachem ammonia test.
Seachem Ammonia.jpg

(left: samples and color card inside white styrofoam, center: cover styrofoam with paper towel with a small hole for photos, right: picture through the paper towel hole)

very even light. seems to have killed off shadows and glare.
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
check out this as a light diffuser for sample / color card tests.
seachem ammonia test.
Seachem Ammonia.jpg

(left: samples and color card inside white styrofoam, center: cover styrofoam with paper towel with a small hole for photos, right: picture through the paper towel hole)

very even light. seems to have killed off shadows and glare.

Thanks. Will give that a try.
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Nitrate Test: Numerical Value

So I took taricha's advice and made a container to diffuse the light. I took an ice cream bucket and lined it with white paper and put a hole in the lid. I put a tissue paper with a hole over the lid to diffuse the light and it does a pretty good job. I took pictures of the Red Sea sample card in the bucket and have the Color Grab app screen grabs attached using the HSV spectrum. From my previous post on Nitrate I am using the saturation value from the HSV color map (Hue, Saturation, Value).

The first graph titled "Nitrate Fit to 50" shows the curve fit using the 2,5,10,20,50 values from the card taken in the ice cream bucket. They are plotted with a log scale on the X-axis and the log curve fit is shown on the graph. With this curve fit you would measure the saturation value of the sample and calculate the nitrate value using this equation:

Nitrate=exp( (Saturation + 4.9774)/19.186 )

I took the saturation values used to generate the curve fit and ran them through this curve fit. In the table in the bottom right of the graph these are the values in the "Curve Fit" column. The "Error" column is the difference between actual nitrate values from the card in the "Nitrate" column and the "Curve Fit" values. This shows that the curve fit is not very accurate at high Nitrate values up above 20. The error is 6.6 at a nitrate of 20 and 11.6 at a nitrate of 50. So if I had a nitrate value of 50 I would measure a saturation value of 65, my curve fit would tell me I have a nitrate value of 38.4 and I would be off by 11.4.

Since my nitrate values are usually in the 2 to 10 range and I wouldn't care much what the value is above 20 since I would be working hard to reduce it, I removed the 50 value from the nitrate card and re-did the curve fit.

The second graph titled "Nitrate Fit to 20" shows the curve fit using the 2,5,10,20 values from the sample card taken in the ice cream bucket. This produces a much better curve fit. Here is the translation from the measured saturation value to the calculated nitrate value using that fit:

Nitrate = exp ( (Saturation + 10.394)/22.705 )

Running the saturation values back through the curve fit the error values are now down to 0.3 or less.

I took pictures of my two samples with the vials in the ice cream bucket. The bucket with the tissue over the top does a good job of eliminating a lot of the glare spots and shadows in the picture. The two samples shown in the pictures have saturation values of 22% and 13%. If I run these through the curve fit I get Nitrate values of 4.2 and 2.8.

I ran one more check of the ice cream bucket by taking pictures at 5 different points in the sample vial for each of my two samples. These values are shown in the final tables. There is still a little variation in the color of the sample due to thickness variations in the bottom of the glass vial.

For the first test sample the saturation ranged from 21 to 24. Running these values through the curve fit gives nitrate values ranging from 3.8 to 4.5 which are within 0.4 of my center-point value of 4.2.

For the second test sample the saturation ranged from 12 to 14 which gives nitrate values ranging from 2.7 to 2.9. These nitrate values are within 0.1 of the 2.8 nitrate value at the center point.

so here is my final curve fit using the ice cream bucket:

Nitrate = exp ( (Saturation + 10.394)/22.705 )

It is valid in the nitrate range of 2 to 20. If it gets above 20 it is time for a water change. If it gets below 2 I will feed the corals and fish a little more to get it back to my target value of 5.

Bucket1.jpg Bucket2.jpg Card1.JPG Card2.JPG Fit50.jpg Fit20.jpg Sample1.jpg Sample2.jpg test.jpg
 

taricha

5000 Club Member
View Badges
Joined
May 22, 2016
Messages
6,483
Reaction score
9,995
Rating - 0%
0   0   0
Those are really tight results for aiming at different parts within the Red Sea glass vial.
using other apps or under normal light, that's really hard. the glare and shadows mean that some other color picker apps can give you answers off by more than a factor of 2 depending on where in the vial you aim.

This looks much better.

I agree that the 50 on the color card seems not applicable.

Question: have you looked at which function, or which color parameterization works best at the very low end of color formation?

Saturation doesn't work at such low deviations from white.
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Those are really tight results for aiming at different parts within the Red Sea glass vial.
using other apps or under normal light, that's really hard. the glare and shadows mean that some other color picker apps can give you answers off by more than a factor of 2 depending on where in the vial you aim.

This looks much better.

I agree that the 50 on the color card seems not applicable.

Question: have you looked at which function, or which color parameterization works best at the very low end of color formation?

Saturation doesn't work at such low deviations from white.

I really need some samples below 2 to play with. Next week I will take some of my samples, measure them, and then dilute some samples down below 2 to see what happens.
 

WallyB

REEF Techno-Geek
View Badges
Joined
Jan 24, 2017
Messages
3,124
Reaction score
8,088
Location
GTA Toronto, CANADA
Rating - 0%
0   0   0
Really Cool.
A TON of creativity.

I'm not color blind but was looking to automate various tests for the Color Transisition point. (Something like the Reef Bot Does, but manually do the drops, while camera scans).
Your efforts are up the same alley.

My thought is using a cheap Raspberry PI, with Camera.

Setup a testing chamber with consistant light.

Find a app or maybe Openvison Has the capability to decode colors and shades.
Watch the titration and alert the color transitions.
Same for measuring Shades/Colors.

Great work. Thanks.
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
Sounds great. Let us know how it goes.
 

WallyB

REEF Techno-Geek
View Badges
Joined
Jan 24, 2017
Messages
3,124
Reaction score
8,088
Location
GTA Toronto, CANADA
Rating - 0%
0   0   0
Sounds great. Let us know how it goes.
ACtually I just tried your Color Grab Apps method.
It's works great.
Using a Salifert ALk test. It picked up the Color Change (Transition Point), before my Eyes did (and I'm not color blind).
That was just one quick test. No special Diffuser, etc.

From all your testing, putting aside app to get RGB.
Lighting, difuser, reflection, transparency are factors to get accuracy, consistancy. You proved it with your various improvments.

I had a similar issue for an image processing algorythm. Reflections off shiny surface really threw a twist on things. Amazing what we take for granted that I eyes do autmatically (auto correct in our brains).

Have you played with zooming in really close on the sample, in a good uniform color spot? Maybe you are already doing that.

Maybe the App or another that can give you a the RGB value of a IDEAL PIXEL in the image that doesn't have the reflection, and is consitant in your LIght-Photo Chamber.
 
Last edited:

Daniel@R2R

Living the Reef Life
View Badges
Joined
Nov 18, 2012
Messages
37,364
Reaction score
63,255
Location
Fontana, California
Rating - 100%
1   0   0
Great info!!!
 
OP
OP
PapaElf

PapaElf

Community Member
View Badges
Joined
Apr 7, 2020
Messages
26
Reaction score
79
Rating - 0%
0   0   0
ACtually I just tried your Color Grab Apps method.
It's works great.
Using a Salifert ALk test. It picked up the Color Change (Transition Point), before my Eyes did (and I'm not color blind).
That was just one quick test. No special Diffuser, etc.

From all your testing, putting aside app to get RGB.
Lighting, difuser, reflection, transparency are factors to get accuracy, consistancy. You proved it with your various improvments.

I had a similar issue for an image processing algorythm. Reflections off shiny surface really threw a twist on things. Amazing what we take for granted that I eyes do autmatically (auto correct in our brains).

Have you played with zooming in really close on the sample, in a good uniform color spot? Maybe you are already doing that.

Maybe the App or another that can give you a the RGB value of a IDEAL PIXEL in the image that doesn't have the reflection, and is consitant in your LIght-Photo Chamber.
Sorry WallyB, missed your post. Didn't mean to snub you. Have actually been pretty happy with the ice cream bucket after using it for months. As you suggested I gravitated towards always sampling the same area of the vial. I move around a little bit and the saturation only varies by 1 point. Good enough for my purpose.
 

Larry L

Valuable Member
View Badges
Joined
Nov 4, 2014
Messages
1,348
Reaction score
1,426
Location
x
Rating - 0%
0   0   0
This is pretty cool stuff. I know @JimWelsh has published info about color transitions in titration tests and how to pick off the correct transition point to call the test "done", just curious what he might have to add here...
 

taricha

5000 Club Member
View Badges
Joined
May 22, 2016
Messages
6,483
Reaction score
9,995
Rating - 0%
0   0   0
This is pretty cool stuff. I know @JimWelsh has published info about color transitions in titration tests and how to pick off the correct transition point to call the test "done", just curious what he might have to add here...

Jim did a different test kit with a different color indicator, but his pH work is universally applicable to other Alk tests. What's missing is for someone to correlate the color scale of the Red sea kit to the pH curve in the same way Jim did for the salifert.
This app and the methods here + quality pH data = done.
 

JimWelsh

Valuable Member
View Badges
Joined
Nov 5, 2011
Messages
1,547
Reaction score
1,679
Location
Angwin, CA
Rating - 0%
0   0   0
This is pretty cool stuff. I know @JimWelsh has published info about color transitions in titration tests and how to pick off the correct transition point to call the test "done", just curious what he might have to add here...
Sorry, just not enough bandwidth available on my end right now. "Real job" demands are quite high this time of year. Interesting stuff being discussed here, though!
 
Back
Top