Clear Filters
Clear Filters

Counting wheat grains and marking them with image processing

5 views (last 30 days)
I cannot seperate grains in groups properly, and it makes counting and marking not good.
  3 Comments
Robert
Robert on 22 May 2024
Thanks, i forgot to attach the matlab code, that i wrote for this. I think the counting is working within 5% of error, but i have problems with separating the grains in huge clusters properly, thats why i cannot mark them well.
Image Analyst
Image Analyst on 23 May 2024
@Robert did you even try the suggestions I gave you in my answer below (scroll down)? If not, why not?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 22 May 2024
First of all, you need to improve your image capture setup. Why do you have such a horrible, colored, and non-uniform lighting? That should be easy to fix. Secondly you will need to do a background correction by dividing the test image by the background. MATLAB also has a background flattening function in one of its toolboxes. Then you can segment the image.
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
As you said, some grains are touching so you'll need to split them apart. See Steve's blogs on how to do this:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!