Adds the specified image to this verification database.
If the image cannot be loaded, this method stops and throws an exception.
Namespace: Cognex.VisionPro.InspectionAssembly: Cognex.VisionPro.Inspection (in Cognex.VisionPro.Inspection.dll) Version: 79.0.0.0 (79.0.0.0)
Syntax
Parameters
- imageFilename
- Type: System String
The full path to the image to be added.
- referenceImage
- Type: System Boolean
Set this to true if the images should be referenced by their full path. Set this to false if the images should be embedded (copied) into the database.
- defaultSimpleResult
- Type: Cognex.VisionPro.Inspection CogVerificationSimpleResultConstants
The default simple result for all the added images
- defaultGrade
- Type: System String
The default advanced grade for all the added images. If NULL then verificationData.Params.ExpectedOutputs.Grade.Value will not be set
Return Value
Type: StringAn array of all the images that were added to the database.
Exceptions
| Exception | Condition |
|---|---|
| InvalidOperationException | Thrown if not currently connected. |
| ArgumentNullException | Thrown if imageFilanem is null. |
| ArgumentNullException | Thrown if the imageFilename is not found. |
| ArgumentNullException | Thrown if the image cannot be added to the database. |
Examples
Imports Cognex.VisionPro
Imports Cognex.VisionPro.Database
Imports Cognex.VisionPro.Inspection
Private Sub Init()
Dim mInputDatabase As New CogVerificationDatabase(New CogDatabaseDirectory("C:\SampleDatabase"))
mInputDatabase.Connect()
' Add image to the database with no grade
mInputDatabase.AddImage("C:\Images\sample.bmp", True, CogVerificationSimpleResultConstants.Accept, "Excellent")
mInputDatabase.Disconnect()
End Subusing Cognex.VisionPro; using Cognex.VisionPro.Database; using Cognex.VisionPro.Inspection; private Init() { CogVerificationDatabase mInputDatabase = new CogVerificationDatabase(new CogDatabaseDirectory(@"C:\SampleDatabase")); mInputDatabase.Connect(); // Add image to the database with no grade mInputDatabase.AddImage(@"C:\Images\sample.bmp",true,CogVerificationSimpleResultConstants.Accept,"Excellent"); mInputDatabase.Disconnect(); }
See Also