You are here: Start » Tutorial Exercises » Finding Razor Head Defects (razor)

Finding Razor Head Defects (razor)

Aim

Develop an application that finds two types of product defects:

  • Check if both razor arms are not broken,
  • Check if smaller arms are not connected.

Show the inspection results on the HMI.

Input

Images of razors heads with defects. Object are lit using backlight. Example defects are marked with red.

Images are stored in razor directory.

Output

Application should show proper information if any of the defects was identified. Design simple HMI which shows result of each inspection.

Hints

This exercise presents one of the typical vision problems. This task uses common algorithm schema:

  • Find element using Template Matching technique,
  • Check defects presence using high-level tools.

Solution (AVS)

  1. Load images from the directory using EnumerateImages filter.

  2. Add LocateSingleObject_Edges filter and connect to it an output of EnumerateImages filter.

  3. Create template model using Model Definition Window. The model is shown on the image below.

  4. Add CheckPresence_PixelAmount filter to check if the distance between inner arms is filled with white pixels.

    This filter checks if a white color covers more than 40% of the selected ROI.

  5. Add two CheckPresence_PixelAmount filters to check presence of arms.

  6. All CheckPresence_PixelAmount filters inputs inRoiAlignment connect with outObject.Alignment of LocateSingleObject_Edges. This step allows to move checking areas when object is moved.

  7. Open the HMI panel and add VideoBox and connect to it the output of EnumerateImages.

  8. Add three PassFailIndicator and connect them with outputs of CheckPresence_PixelAmount filters.

  9. Add Label with "Razor inspection" text.

Macrofilter Main finds razor defects using Template Matching and technique.