Aurora Visio Studio TOP » Program Examples » Waffles

Waffles

目的

The aim of the program is to separate waffles with a proper amount of chocolate from the damaged ones.

Input

Several images of waffles. The amount of chocolate on the waffles is variable.

Output

Image with its inspection result (OK or not OK) and a rectangle indicating the border between chocolate and waffle area.

ヒント

Waffle can be located by thresholding to a region. To check whether a chocolate spilled out of the border area, a region of interest has to be reduced by performing a morphological erosion on the region corresponding to the waffle.

接続のラベル付けについては こちらを参照ください。

Solution (AVS)

  1. In Workspace Explorer open workspace Examples and in Film strip window select Waffles dataset. Drag the Image channel to the ACQUIRE section.
  2. To threshold an image, use the ThresholdToRegion. Set the inMaxValue to 200.
  3. Add the ErodeRegion filter and set the inRadiusX to 20. Connect the outRegion from a previous filter with inRegion of the current one.
  4. To bound the region, use the RegionBoundingRectangle_OrNil filter.
  5. To create a rectangle region, use the CreateRectangleRegion and set the inFrameWidth to 656 and the inFrameHeight to 492. Connect the outBoundingRectangle from a previous filter with the inRectangle input.
  6. If you want to threshold the image just in area of the waffle, use the ThresholdToRegion again, set the inMaxValue to 120, connect the inImage with the ReadFilmstrip output and connect the inRoi with the outRegion from the CreateRectangleRegion filter.
  7. To determine the area of chocolate within reduced region, right-click on the outRegion output, find Property Outputs and choose Area. This selected output should appear in the filter as the outRegion.Area.
  8. To check if the region corresponding to the chocolate has the area in specified range, use the TestIntegerInRange filter and connect the outRegion.Area with the inValue input of the current filter. Set the inMaximum to 600.
  9. Now create a formula with two outputs:

    • The output ResultStrings of type String? and create there an output message:

      ResultStrings = if inRegionArea<=600 then "OK" else "NOK: Damaged waffle"

    • The output ResultColorID of type Integer? and create there an output message:

      ResultColorID = if inRegionArea<=600 then 1 else 0

  10. Add the DrawStrings_MultiColor filter and connect the ReadFilmstrip output with the inImage input of the current filter.

    • Connect the ResultStrings with the inStrings input.
    • Connect the ResultColorID filter output with the the inColorIds of the current filter.
  11. Add the DrawRectangles_SingleColor filter and connect the outImage from the previous filter with the inImage of the current filter. Connect the outBoundingRectangle with the inRectangles input of the current filter.
  12. Use the outImage as a preview.

マクロフィルタ メイン

使用したフィルタ

アイコン 名前 説明
CreateRectangleRegion Creates a region corresponding to a given rectangle.
ErodeRegion Making the region thinner or removing small parts.
RegionBoundingRectangle_OrNil Computes the smallest rectangle containing a region; returns NIL if the region is empty.
DrawStrings_MultiColor 画像上に複数の色で文字列(テキスト)を描画します。
ThresholdToRegion 顕著な明るさによって定義できるオブジェクトの領域の抽出。
DrawRectangles_SingleColor 画像上に単色で四角形を描画します。

その他の資料

  • Blob Analysis - ブロブ分析手法について詳しく説明します。