Advertisement
4rchB1sh0p

Untitled

Mar 28th, 2022
669
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %{
  2. % k
  3. aw
  4.  
  5. acwac
  6.  
  7.  
  8. means clustering to classify objects in 2 different groups.
  9. %k means clustering is the quikest way to figure out the number of rice
  10. %grains and number of peas in the image, based on the area of individual
  11. %however this method is not giving accurate result, it counts one rice
  12. grain extra!
  13. [grain_count] = kmeans(stats2.Area,2);
  14. for i =1:length(grain_count)
  15.     if grain_count(i)==1
  16.         rice_count_2(i)= rice_area(i);
  17.     else grain_count(i)==2
  18.         peas_count(i) = rice_area(i);
  19.     end
  20. end
  21. max_rice_area = max(rice_count_2);
  22. ricegrains = find([stats2.Area] < max_rice_area);
  23. %}
Advertisement
RAW Paste Data Copied
Advertisement