Assembly: Cognex.VisionPro.Caliper (in Cognex.VisionPro.Caliper.dll) Version: 65.1.0.0
Parameters
- inputImage
- Type: Cognex.VisionPro CogImage8Grey
The image to which the Caliper is applied.
- region
- Type: Cognex.VisionPro CogRectangleAffine
The Caliper input region. The supplied CogRectangleAffine (no other region type is allowed) is used to sample the image and create a one-dimensional projection image. The projection image is filtered, and the detected edge peaks are evaluated as possible caliper results.
Return Value
Type: CogCaliperResultsA CogCaliperResults object containing the results of this function.
| Exception | Condition |
|---|---|
| CogSecurityViolationException | Security is not enabled for this vision tool. See Resolving Security-Related Error Messages for more information. |
| CogOperatorNoInputImageException | Image is NULL. |
| CogOperatorInvalidRegionException | The selected space of region is not a valid space in Image or no part of region lies within Image. |
| CogCaliperNoScorersException | The supplied scoring collection is null or empty or all the scorers are disabled and a nonzero number of results has been requested. |
| CogCaliperBadScorerException | A single-edge scorer is in the two-edge scorers collection or a two-edge scorer is in the single-edge scorers collection. |
| CogCaliperImageTooSmallException | There are not enough pixels for the projected image. |
Apply the caliper to the given image with the given region of interest. If Region is not specified, the entire image will be used.
Imports Cognex.VisionPro Imports Cognex.VisionPro.Caliper Imports Cognex.VisionPro.ImageProcessing ' Construct the individual objects Dim myCalOp As New CogCaliper Dim myResults As CogCaliperResults Dim myRegion As New CogRectangleAffine ' Region should be configured to contain region of interest myCalOp.MaxResults = 1 myCalOp.Edge0Polarity = CogCaliperPolarityConstants.DarkToLight myCalOp.Edge1Polarity = CogCaliperPolarityConstants.LightToDark myCalOp.EdgeMode = CogCaliperEdgeModeConstants.Pair ' anImage has been acquired previously myResults = myCalOp.Execute(CType(anImage, CogImage8Grey), myRegion)
using Cognex.VisionPro; using Cognex.VisionPro.Caliper; using Cognex.VisionPro.ImageProcessing; // Construct the individual objects CogCaliper myCalOp = new CogCaliper(); CogCaliperResults myResults; CogRectangleAffine myRegion = new CogRectangleAffine(); // Region should be configured to contain region of interest myCalOp.MaxResults = 1; myCalOp.Edge0Polarity = CogCaliperPolarityConstants.DarkToLight; myCalOp.Edge1Polarity = CogCaliperPolarityConstants.LightToDark; myCalOp.EdgeMode = CogCaliperEdgeModeConstants.Pair; // anImage has been acquired previously myResults = myCalOp.Execute(anImage , myRegion);