Hi,
if the image is assigned to the variable img, then
ImageMultiply[
Erosion[DeleteSmallComponents[
GeodesicClosing[
GeodesicOpening[
AlphaChannel@RemoveBackground[img, {"Foreground", Brown}], 15],
10], 100], 8], img]
gives
![enter image description here](http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-19at23.38.04.png&userId=48754)
DeleteSmallComponents[
ImageMultiply[
Erosion[DeleteSmallComponents[
GeodesicClosing[
GeodesicOpening[
AlphaChannel@RemoveBackground[img, {"Foreground", Brown}], 15],
10], 100], 8], img], 1200]
removes the small components.
![enter image description here](http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-19at23.39.37.png&userId=48754)
If you want a white background use:
RemoveBackground[
DeleteSmallComponents[
ImageMultiply[
Erosion[DeleteSmallComponents[
GeodesicClosing[
GeodesicOpening[
AlphaChannel@RemoveBackground[img, {"Foreground", Brown}], 15],
10], 100], 8], img], 1200], {"Background", "Uniform"}]
![enter image description here](http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-19at23.41.01.png&userId=48754)
You can colorise the individual trees (note that it doesn't work right for two close trees in this image):
MorphologicalComponents[
RemoveBackground[
DeleteSmallComponents[
ImageMultiply[
Erosion[DeleteSmallComponents[
GeodesicClosing[
GeodesicOpening[
AlphaChannel@RemoveBackground[img, {"Foreground", Brown}],
15], 10], 100], 8], img], 1200], {"Background",
"Uniform"}]] // Colorise
![enter image description here](http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2015-11-19at23.43.50.png&userId=48754)
This here would count the trees (at least approximately):
Length[Select[
ComponentMeasurements[
MorphologicalComponents[
RemoveBackground[
DeleteSmallComponents[
ImageMultiply[
Erosion[DeleteSmallComponents[
GeodesicClosing[
GeodesicOpening[
AlphaChannel@RemoveBackground[img, {"Foreground", Brown}],
15], 10], 100], 8], img], 1200], {"Background",
"Uniform"}]], "Area"], #[[2]] > 1000 &]]
In this case it gives 12 which corresponds to the large coloured areas in the last image. Hence, it only counts well separated trees.
Cheers,
Marco