Aurora Visio Studio TOP » Program Examples » Washers

Washers

目的

This example shows how to find washers with defects or not properly centered.

Input

Set of images with multiple washers.

Output

Image with marked broken and not properly centered washers.

Histogram of distances between inner and outer contour of a washer.

ヒント

Washers can be located by thresholding image and splitting resulting region into blobs.

The FitCircleToStripe filter can be used to find inner and outer circle of a washer.

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

Solution (AVS)

  1. In Workspace Explorer open workspace Examples and in Film strip window select Washers dataset. Drag the Image channel to the ACQUIRE section.

  2. Add the ThresholdToRegion filter. Set the inMinValue to Auto and the inMaxValue to 200.0 to extract washers.

  3. Add the SplitRegionIntoBlobs filter to obtain separate washers.

  4. Use the RegionMassCenter filter to calculate washer centers. Click on the outMassCenter twice and change its name to MassCenters

  5. Add the CreateCoordinateSystemFromPoint filter and connect MassCenter to the inPoint.

  6. Add the FitCircleToStripe filter. Connect Image to the inImage. Connect the outCoordinateSystem to the inFittingFieldAlignment, that way you will only need to specify fitting field for one washer.

    • Run program to refresh the image and coordinate system, they will be later used to specify fitting field.

    • Specify the inFittingField. In fitting field editor select washer with coordinate system inside:

    • Set the inScanCount to 20 and the inMaxIncompleteness to 0. This will make the filter detect only complete washers and skip broken ones.

    • Using Show/Hide Ports show the outInnerCircle.Center and the outOuterCircle.Center. Change their names to InnerCircleCenter and OuterCircleCenter

  7. Add the PointToPointDistance filter to measure distance between the centers of inner and outer circle. Change the name of the output to the WasherErrorOrNil

  8. To create histogram of distances:

  9. Create a step macrofilter and name it DrawResults.

    • Connect the ReadFilmstrip output to the DrawResults to create a new macrofilter input. Check Array checkbox.

    • Connect the MassCenters and the WasherErrorOrNil to the DrawResults in order to create new inputs. Check Array checkbox.

    • Double-click on the DrawResults to edit the macrofilter.

    • Add a new formula to generate labels for washers. Create the Real? input inDistance.

    • Create formula outputs:

      • outString, type String?:

        (inDistance == Nil) ? "Invalid" : ((inDistance < 0.5) ? "OK" : "NOK")

      • outIsWasherOk, type Bool?:

        outString == "OK"

    This will mark washer as valid when distance between centers is less than 0.5 and the washer is not broken.

マクロフィルタ メイン

Macrofilter DrawResults draws inspection results on input image

使用したフィルタ

アイコン 名前 説明
ThresholdToRegion 顕著な明るさによって定義できるオブジェクトの領域の抽出。
RemoveNils This filter is useful e.g. when inspecting multiple objects while some of the inspections may fail (Nil result). RemoveNils is used to ignore the failed cases in the final result.
RegionMassCenter 領域のピクセルの平均座標に等しい座標を持つ点を計算します。
CreateHistogram Creates the histogram of the array of real numbers.
SplitRegionIntoBlobs オブジェクトが互いに接触していない場合に、領域を個々のオブジェクトにセグメント化します。
DrawStrings_MultiColor 画像上に複数の色で文字列(テキスト)を描画します。
PointToPointDistance Measures the distance between two points.
CreateCoordinateSystemFromPoint 1D エッジ検出またはブロブ分析の結果からオブジェクトの位置合わせを定義するために最もよく使用されます。
FitCircleToStripe Precise detection of ring-shaped objects, whose rough location is known beforehand.

その他の資料

  • 数式 - 数式の使用に関する詳細情報です。
  • Local Coordinate Systems - 座標系の使用に関する基本的な概念について説明しています。
  • Shape Fitting - シェイプ フィッティング テクニックの使用法を紹介します。
  • Shape Fitting Filter Group - Shape Fittingを行うために使用されるすべてのフィルターのリスト