Friday, June 30, 2017

Segmenting Cherry Tree Images

It's difficult to segment images of fruits and fruit trees when their colors are very similar. Last week the public could pick their own cherries at fruit orchards like Williamson's (we got 20 pounds). So I took the opportunity to record visible, near infrared, and thermal infrared images of some of the cherry trees prior to picking fruit. Then today I tried my hand at segmenting the images.

The image I started segmenting
First my script separated the three color layers of the images. Then it compared the three layers so I could see how different they were. I discovered that the red leaves have a lot of red in them (very surprising).

Red layer on the left and green layer on the right. Notice that the leaves are only slightly darker in red than in green. On the other hand, the red cherries are too dark to appear in the green layer.
To create an image that Matlab could work with, I subtracted the green layer from the red layer to create a new image. Notice how well the cherries stand out from the leaves now.
Only cherries and a few stems/branches show up now. 
The resulting cherry layer could be segmented after determining a threshold value of intensity. The final results are displayed below.

From left to right: The original image, the separated cherries, and the segmented cherries.
Three obvious cherries appear in the final segmented image. The smaller dot is a cherry partially exposed behind a leaf. What does not show up are the cherries in the shadows of leaves. I want to experiment with bringing them out. Then I'll be ready to start measuring the size of the segmented regions and count them. Perhaps I'll even look into converting the blobs into elliptical circles for better assessment.

No comments:

Post a Comment