# Structure Recognition within images by Machine Learning with scikit-learn

I want to solve the following problem:

Quantify the share (numbers of pixels) of soil, leaves and fruit (ears) within the given image.

For soil, this can easily be solved by looking at one of the color-bands, e.g. green, and identify all pixels with a gray value below a certain threshold. That means: very dark pixels are soil background.

Now for the fruit ears this becomes more difficult. I'd like to set up an algorithm that identifies their structure and labels those features for me. This cannot be done by pixel-per-pixel analysis, because it's the shape of the feature that defines its true nature. In other words: leaves and fruits are both green, but they look different. If I as a person can distinguish them, an algorithm can do so as well.

I tried skimage's contours, but I will need a machine learning algorithm to help me. Most examples and tutorials I found were categorising whole images (e.g. the "digits" dataset that recognizes hand-written digits). I am puzzled about what algorithm I should try. I can imagine both supervised or unsupervised classification.

Any help or hint is very much appreciated, thanks!