In a previous article I described a technique to determine the dye concentration from drone images, and I hope it sounded like a reasonable plan. Nevertheless, this plan did go ary when less than ideal conditions arose and the results got jumbled with the imperfections of the real world. So to make amends, I will layout a new pipeline that–with any luck–will work better in practice than the previous one. As of this writing, the method is working quite well on the images that we received from the field last week.

To take you through this tutorial, I’ve decided on this simple yet interesting image from my collection. There are most certainly better ones to use, but this is a nice general image.

Original

 

By definition, jpeg used one of a half dozen or so RGB color spaces[1] available. But to save ourselves from the minutiae, the image is always understood as composing three, additive frames of Red, Green and Blue as seen below. When overlayed, these three frames sum to the final image seen above.

This should all seem trivial, but until you have played around with images some of the ideas here may seem foreign at first glance. For example, these three color frames can be manipulated independently or details from one frame can be moved to another.

Imagine you had an image where there was a blue stain on someone’s shirt and wanted to present a print of this image as a gift. You could edit the photo and remove the stain with photoshop and, depending on your skills with the program, it might take a bit of work. Instead you could take the blue frame of and simply remove that section of the image in microsoft paint or whatever and get the job done a lot quicker.

While this was a hypothetical scenario but the idea is certainly generalizable. Below are simple edits to the original photo above. Notice that the first appears muddled and featureless while the second is still sharp. Can you guess as to why that might be?

Before getting too far into this, I feel obliged to give you some of the tools that make this sort of analysis (i.e. play) possible. I highly recommend the ImageJ program which has been developed by the National Institute of Health (along with countless volunteers from around the world) for working in a quantifiable way with images. It allows you to do nearly any analysis you could imagine on an image. There are also thousands of excellent plugins for it as well.

Select the color, saturation and brightness of the features of interest.
Select the color, saturation and brightness of the features of interest.

For example, here is the plugin that I found invaluable when trying to isolate a patch of dye from the surrounding sea water. The Color Threshold plugin allows you to select out specific portions of an image so that they can be manipulated independently from the rest of the image.

For the dye, I was able to isolate the red channel, exclude the overexposed white pixels and make sure that there was “enough” red in them before removing all of  the background. This left me with beautifully isolated patches of dye without the rest of the water or glare from the sun. I’ll include images here once the photos are cleared to be posted.

To give you a sense of what I mean by this, here is the original image with the blue parts isolated and removed from it. Notice how finely the background has been removed from the image. While a similar effect could have been accomplished with the ‘magic wand’ tool, this technique will also work  for complex or difficult to isolate backgrounds.

Isolate the object from it's background using ImageJ.
Isolate the object from it’s background using ImageJ.

The last thing I want to mention before leaving you on your own is something I noticed today. I used the color threshold utility to isolate certain portions of our stock image before filling them with black. The result, which you’ll see below, was to enhance some of the relief in the image.

While I have no idea if this might be useful, perhaps one of you will come up with a way to use it effectively.

Through use of color threshold, you can also artificially enhance an image to selective features.
Through use of color threshold, you can also artificially enhance an image to selective features.

 


Notes

  1. The JPEG standard does not specify any one of the ICC standards to use but common ones are the sRGB and adobeRGB. These are used >99% of the time.