You are here: Start » Tutorial Exercises » Counting Saw Teeth (count_teeth)

Counting Saw Teeth (count_teeth)

Aim

Create an application that finds the number of blade's teeth.

Input

A single image of the saw blade.

Image is stored in count_teeth directory.

Output

The number of teeth.

Hints

The teeth of the blade are located evenly around the mounting hole of the blade.

Locate central mounting point using DetectSingleCircle filter. Measure a blade radius using the measuring distance tool.

Blade teeth can be measured like stripes using ScanMultipleStripes.

Create circular path for scanning path using CreateCirclePath filter. This filter converts geometrical shape to the set of straight segments. It is necessary to select value of inPointCount that will make scanning each tooth possible.

Labeling connections is explained in this article.

Solution (AVS)

  1. Add filter LoadImage to ACQUIRE section to get an image from the file.

  2. Measure the radius of the mounting hole using the measuring tool.

  3. Add DetectSingleCircle filter to PROCESS section and set the value of expected circle radius with the measured radius.

  4. Reduce a DetectSingleCircle ROI to the middle part of an image to increase a detection speed.

  5. Expand the outCircle.Circle output and get the Center property.

  6. Add CreateCirclePath filter, right-click on inCircle and expand structure fields. Set the value of inPointCount to 50. Connect outCircle.Center with inCircle.Center and set inCircle.Radius to 125 which is the approximate distance between the center of the hole and the teeth of the blade.

  7. Add ScanMultipleStripes filter to find stripes crossing the prepared path. Connect outImage with inImage and connect outPath with inScanPath. Set inStripeScanParams.StripePolarity to Dark because the teeth are black.

  8. Expand outStripes of ScanMultipleStripes filter and get Count property output.

  9. Show outStripes.Count in a new preview window.

Main macrofilter calculates the teeth count by scanning stripes around a circular path.

Additional Tasks

  • Unroll the image along the circular path into a single straight image using ImageAlongPath.
  • Find the mounting using the Blob Analysis techniques.

Further Readings

  • 1D Edge Detection - The article explaining how edge detection filters work.
  • Blob Analysis - Article presents detailed information about the Blob Analysis technique.
  • Image Processing - A comprehensive introduction to Image Processing.