You are here: Start » Program Examples » Shipment Verification
Shipment Verification
Aim
The aim of the program is to count the number of boxes in a container and mark each of them with a stripe.
Input
An image of boxes in a container.
Output
Detected boxes and their count.
Hints
The easiest and the quickest way to achieve this goal is to use 1D Edge Detection technique and detect boxes as stripes.
Solution (AVS)
- Add LoadImage filter. Please, remember about setting directory to the images in the Properties window of the filter.
- Add ScanMultipleStripes filter.
- Connect outImage from the first filter with inImage of the second one.
- Click on ScanMultipleStripes. In Properties window (in the bottom left corner) make these changes:
- Define a scanning path in inScanPath horizontally so that it embraces all the boxes.
- Set inStripeScanParams.MinMagnitude to 10 which is the approximate minimum value of transition between bright stripes and dark gaps.
- Set inStripeScanParams.StripePolarity to Bright because we want to find the bright stripes.
- Set inStripeScanParams.MinStripeWidth to 40. The width of the box is about 42-43, so it is a safe lower limit.
- Set inStripeScanParams.MaxStripeWidth to 50. It is a safe upper limit - without it some wider stripes might be detected.
- Right-click on outStripes, find Property outputs and select outStripes.Count
Macrofilter Main
Used Filters
Icon | Name | Description |
---|---|---|
LoadImage | Loads a single image from a file. | |
ScanMultipleStripes | Very fast detection of multiple pairs of opposite edges - usually for counting or width measurements. |
Further Readings
- 1D Edge Detection - The article explaining how edge detection filters work.