You are here: Start » Program Examples » Fertilizer Granulation

Fertilizer Granulation


Devise an algorithm which will examine the granulation of the fertilizer and detect grains which sizes do not fit in specified range.


Single image of the granulated fertilizer.


Detected and circled correct and incorrect pills:


Performing some operations on the image will help you detect the center of each granule.

Labeling connections is explained in this article.

Solution (AVS)

  1. In Workspace Explorer open workspace Examples and in Film strip window select FertilizerGranulation dataset. Drag the Image channel to the ACQUIRE section.
  2. To easily distinguish the dots use the SmoothImage_Gauss to make the image blurred. Change the inStdDevX to 2.5.
  3. Add the ImageLocalMaxima filter to detect all the centers of the circles-to-be. Change the inConsiderPlateaus to True.
  4. Create a circle using the CreateCircle filter. To the inPoint connect the outLocalMaxima.Point - detected centers of the circles. Set the inRadius parameter in filter properties as 8.
  5. The next step is to fit the circles to the original image. You can do it with the FitCircleToRidges filter. As the inImage use the original image. Connect the outCircle positions to the inFittingField.Axis. Change of the following parameters will be required:
  6. Create a formula using right-click and the Add Formula Here option to compare the outCircle.Radius. Set the minimal value as 6 and maximal value as 10. Add ?? False at the end of it to filter out any Nil occurrences and set them as False by default.
  7. Add the DrawCircles_MultiColor. As the inImage use the original image. To the inCircles connect the outCircle from the FitCircleToRidges filter. Connect the outIsInRange to the inColorIds. You can change the marking hue in the properties of the filter. They are green and red by default.

Macrofilter Main

Used Filters

Icon Name Description
CreateCircle Creates a circle from an aligned point and radius.
SmoothImage_Gauss Removal of gaussian noise from images.
DrawCircles_MultiColor Draws circles on an image with multiple colors.
FitCircleToRidges Precise detection of a thin circular line, whose rough location is known beforehand.
ImageLocalMaxima Detection of characteristic points, usually after some image transformations.

Further Readings

  • Image Processing - A comprehensive introduction to Image Processing.
  • Shape Fitting - This article presents usage of the Shape Fitting technique.