You are here: Start » Program Examples » Plate Measurement (Advanced)

Plate Measurement (Advanced)

Aim

The aim of the program is to measure the the length of a metal plate.

Input

An image of a metal plate.

Output

The image of the metal plate with marked segments connecting the edges vertically and information about plate's length.

Hints

This is the advanced variant of the same example as Plate Measurement. Here we use an analogous approach, however some advanced tools are applied so if you do not feel secure enough, we recommend to take a look at Plate Measurement example first.

Solution (AVS)

  1. Add the FindFiles filter to enumerate images in an array mode.
  2. Add the LoadImage filter and connect outFilePaths to inFile.
  3. Add a new step macrofilter Measure. Connect outImage to its inputs.
  4. In Project Explorer find the Create New Global Parameter button, click it and:
    • Set name to ScanCount,
    • Set type to IntegerArray,
    • Set values: 5, 10, 20, 30, 50. This will allow you to perform several width measurements with a different number of scans each time. When widths in each iteration are eventually computed, output data is collected in an array, and in this way some statistics (like standard deviation) can be calculated.
  5. Connect ScanCount to the macrofilters inputs as an array connection and step inside it.
  6. Add the MeasureObjectWidth filter to compute the width, which is the most suitable filter to use in that case.
  7. Connect macrofilter's inInput to inImage.
  8. Connect macrofilter's inScanCount to inScanCount.
  9. Click on the MeasureObjectWidth filter and make these changes in Properties window (in the left bottom corner):
  10. Add the RemoveNils filter to remove potential Nil values. Connect outObjectWidth to inArray.
  11. Add the Statistics_OfArray filter to get some basic statistics and connect outArray to inValues.
  12. Connect outStandardDeviation to macrofilter outputs as outStandardDeviation.
  13. Go back to Main and add the RealArrayToProfile filter to get a profile from an array of Real values. Connect outStandardDeviation from Measure macrofilter with inArray. As you can see based on the profile, that the more scans are performed, the more precise measurement is (standard deviation gets gradually lower).

Macrofilter Main

Macrofilter Measure

Used Filters

Icon Name Description
MeasureObjectWidth Measures the width of an object using stripe detection.
RealArrayToProfile Converts an array of real numbers to a profile.
Statistics_OfArray Computes basic statistical information out of an array of real numbers. The array must be not empty.
LoadImage Loads a single image from a file.
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.
FindFiles Returns files of the input directory.

Further Readings