CogVerificationDatabase AddImages Method (String, Boolean, CogVerificationSimpleResultConstants, String)Cognex VisionPro 9.21
Adds all the images in the specified image directory to this verification database. If any image in the image directory cannot be loaded, this method stops and throws an exception.

Namespace: Cognex.VisionPro.Inspection
Assembly: Cognex.VisionPro.Inspection (in Cognex.VisionPro.Inspection.dll) Version: 83.0.0.0 (83.0.0.0)
Syntax

public string[] AddImages(
	string imageDirectory,
	bool referenceImages,
	CogVerificationSimpleResultConstants defaultSimpleResult,
	string defaultGrade
)

Parameters

imageDirectory
Type: System String
The full path to the directoy that holds the images to be added.
referenceImages
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 add 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:  String 
An array of all the images that were added to the database.
Exceptions

ExceptionCondition
InvalidOperationException Thrown if not currently connected.
ArgumentNullException Thrown if imageDirectory is null.
ArgumentNullException Thrown if imageDirectory is not found.
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", True, CogVerificationSimpleResultConstants.Accept, "Excellent")

        mInputDatabase.Disconnect()
End Sub
using 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",true,CogVerificationSimpleResultConstants.Accept,"Excellent");

    mInputDatabase.Disconnect();
}
See Also