# Counting wheat plants in a photo

9 views (last 30 days)
David David on 27 Nov 2019
Closed: Image Analyst on 28 Nov 2019
I have 2 photos (1a/2a.png) and my objective is to count the number of clusters of leaves in order to count the approximate number of plants in the photo.
The black and white photo shows my progress however I need to clear the noise without removing any important information. Is this possible?
Thanks,

#### 1 Comment

David David on 27 Nov 2019
Another photo ...

It is not clear what you have already done to reach the b/w images, what I would do as first steps would be
1) exploit the fact that the plants are greeen and the rest is brown, i.e. use a combination of the rgb channels or much better transform from rgb to hsv and locate the hue that corresponds to green and then segment that colour
2) apply a low pass filter to remove some of the noise (these two steps may alternate order)
3) apply a transform to detect line segments, callibrate for certain lengths to discard small lines and too long ones (which can be two plants)
4) count the number of lines.

David David on 28 Nov 2019
Around 15 plants. With due respect, I accepted the idea because it provides a solution which is probably more exact than yours. I still haven't had the chance to try it out fully but it is looking good so far. I am looking for a solution that involves image processing. I have tried averaging the amount of green there is per area (I divided the image in 9 squares (3x3)) and finding approximately the number of plants in there regarding the greenness of the area however this is quite inexact as I have to compare it with other photos.
Image Analyst on 28 Nov 2019
But to count the line segments, and get a plant count from that you have to know how many lines there are per plant. And since plants have different numbers of leaves, and some leaves touch other plants (leading to undercounting leaves), this doesn't seem very accurate either. Have you done a scatterplot of line count vs. area fraction to see what that looks like? Or scatter area fraction vs. plant count or scatter line count vs. plant count? Can you show us those scatterplots so we can see the correlation?
David David on 28 Nov 2019
Thank you everyone for your time (especially Image Analyst) but I do not have enough time for solving this problem. Can the Moderators close this question?

Image Analyst on 27 Nov 2019
I strongly suggest you give up the idea of counting plants as individual blobs, and just go with "area fraction of green" as your metric if you're aiming to determine growth of the plants.
If you're trying to determine germination rate, like how many plants per square meter per known weight of seeds (and hence number of seeds) spread over that square meter, then you should spend the time to make up a calibration table. To do this you plant a number of seeds well separated from each other. Then count how count how many germinated and compute the green area fraction. Then wait a few days and compute the area fraction again, and so on until the plants are as old as you ever expect to need to run this analysis. Now divide the area fraction by the known number of plants in the image to get the area fraction per plant as a function of age. After this you will have a calibration table that is a two column matrix where age is the first column, and the area fraction for a single plant is the second column.
Now, to measure a test image, you measure the area fraction. Then you go to the row that represents the known age of the plants (measured in the same way you did for constructing the calibration), and look up the area fraction for one plant in your calibration table for that age. You might have to interpolate between ages if the age is not directly in the table. Then you simply divide the area fraction of your image by the area fraction of a single plant to get an estimate of the number of plants in the image.
Note that this or any method will start to break down once the plants overlap a lot (which is undetectable in the image). for example if the image is all green, we have no idea how many plants there are -- could be one, could be hundreds.