Here Chris Fastie was speculating that Trapa Natans should be detectable from balloon mapping data on the basis of it's blue green and/or leaf size. Classification from color can be problematic, as color depends on a number of factors including the spectral content of the illumination (which depends on the weather, the season and the time of day etc), but all of these images were taken at about the same time on the same day, so I wanted to see what I can do. What follows can be considered a crude color-based classifier. The good thing about it is that I understand what my decision criteria are in terms of simple statements about color. Much better can probably be done with a more sophisticated classification scheme.
This image from Chris has a nice large patch of Trapa in the large circle at the bottom center. To sum up what I did (more technical details on request) I cut out smallest rectangle of that image that contains that circle.
and measured the chromaticity (color) and luminance (brightness) of the pixels in this chip. You could do this by hand in imageJ by selecting a rectangle from the dense Trapa in the circle, e.g. this one
pasting into a new RGB color image, using Color->Split Channels to separate out the R,G,B grayscale images and then for each save as a text image to get the 8bit R,G,B values for each pixel--chromaticity can computed in an excel spread sheet for each pixel as {R/(R+G+B),G/(R+G+B)} for each pixel. The rectangle has average chromaticity values {0.311, 0.478} with standard deviations {.007, .008}, while a pixel I picked at random just outside the circle had chromaticity values more than four standard deviations from the rectangle average.
So how good is chromaticity at detecting Trapa? Good, not perfect is my non-technical summation. To visualize how good it is and isn't, below are two animated GIFs with three images each. The first image in each is one of Chris Fastie's. For the the second image, I set what I thought were reasonable thresholds for saying that the the chromaticity of a pixels was close enough to Trapa, and then zeroed to black all pixels that didn't meet that criterion. For the third image I refined the criterion to say in addition that the luminance had to be close to the luminance of Trapa as well--and this seems to have improved the results. (I wanted to keep Chris' circles, so there are also some odd white pixels also show up--the boat, flowers & glare, I think)
In the above image#2 we can see that chromaticity finds the patch that I used to grab the color, and has something about the same chromaticity in the other circles. It also finds stuff of about the same chromaticity in many places. In particular it finds some stuff below the lower right lawn chair and to the right of the lower right small circle that is clearly not Trapa, and is appreciably darker (smaller luminance), even though the chromaticity is correct. Image #3 above selects for pixels matching luminance as well as chromaticity. Some of the circles that were identified as having Trapa do not have pixels that match in both chromaticity and luminance. Since I'm not sure what is the ground truth, I'm not sure if I've thrown out the baby with the bathwater. It would make sense though that the false negative rate would go up if I increase the number of conditions to satisfy.
The above higher resolution image provides a test of color-based classification. Again, the second image is chromaticity-based, and the third image is both chromaticity and luminance based. The good news is that the circles where we can clearly visually distinguish Trapa in the first image based on color and leaf shape are clearly and correctly identified as having Trapa in the second and third images. Some of the circles where there is more going on (e.g. upper right circle, where there may be some larger-leafed plant competing with the Trapa) may not be in agreement--these may be false negatives. In the second image there are some pixels that are clearly not Trapa with the same chromaticity but not the same luminance as Trapa that are eliminated from the third image. In both images #2 and #3 there are many locations that pass the chromaticity or chromaticity and luminance requirements, that are identified as being Trapa--these may be false positives.
9 Comments
This is great information. In the first GIF, the second largest circle, near the top, has a nice large patch of pure Trapa that appears to be similar to the bigger patch you used for training. I guess it's a bad sign that the upper patch was not flagged very well. In the second GIF, it looks like a lot of the white specks in the chromaticity plus luminance image are the flowers of white pond lily. I guess that's a good sign.
Except for the big pure Trapa patches, when I drew all of those circles my brain had to focus on the repeating pattern of leaves of Trapa which are smaller than the leaves of other plants there. Maybe an algorithm is going to have to do the same thing.
Thanks for explaining this approach. This is really good progress.
Reply to this comment...
Log in to comment
Chris, that's interesting. That patch is significantly less blue that the training patch. I wonder why. Maybe different specularity? From your EXIF data and this website I can get the angle of the sun. Do you know how figure the orientation of the camera?
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment