Cog3DModelFeatureGeneratorUsingCrsp2D3Ds GenerateFeaturesModel3D Method Cognex VisionPro 9.22 SR1
This static method generates 3D model features from the specified crsp2D3DsForAllPartPoses and the specified raw2DFromPhys3Ds.

Namespace: Cognex.VisionPro3D
Assembly: Cognex.VisionPro3D (in Cognex.VisionPro3D.dll) Version: 87.1.0.0
Syntax

public static Cog3DModelFeatureGeneratorUsingCrsp2D3DsResults GenerateFeaturesModel3D(
	List<Cog3DCameraCalibration> raw2DFromPhys3Ds,
	List<List<Cog3DCrsp2D3D>> crsp2D3DsForAllPartPoses
)

Parameters

raw2DFromPhys3Ds
Type: System.Collections.Generic List Cog3DCameraCalibration 
A List of camera calibration objects. May not be null.
crsp2D3DsForAllPartPoses
Type: System.Collections.Generic List List Cog3DCrsp2D3D  

The List of Lists of 2D feature to 3D model feature correspondences. The specified crsp2D3DsForAllPartPoses are indexed as crsp2D3DsForAllPartPoses[partPoseIndex][crspIndex]. Each crsp2D3D in crsp2D3DsForAllPartPoses should be fully initialized. It is OK for the FeatureRaw2D member of some crsp2D3DsForAllPartPoses to be null, indicating that no 2D feature was found.

If any crsp2D3D in crsp2D3DsForAllPartPoses[i][j] and crsp2D3DsForAllPartPoses[m][n] correspond to the same 3D model feature, then crsp2D3DsForAllPartPoses[i][j].FeatureModel3DIndex must be the same as crsp2D3DsForAllPartPoses[m][n].FeatureModel3DIndex, and crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType must be the same as crsp2D3DsForAllPartPoses[m][n].FeatureModel3DType.

crsp2D3DsForAllPartPoses[i][j].PartInstanceIndex must be 0.

Return Value

Type: Cog3DModelFeatureGeneratorUsingCrsp2D3DsResults

A Cog3DModelFeatureGeneratorUsingCrsp2D3DsResults results object containing a List of the 3D model features and a List of the pose of the part in each part pose. The List of part poses in the results object is indexed by part pose index. The List of 3D model features is indexed by the FeatureModel3DIndex used in the specified crsp2D3DsForAllPartPoses. Thus, the crsp2D3Ds in crsp2D3DsForAllPartPoses with a FeatureModel3DIndex of N, were used in the generation of (Cog3DModelFeatureGeneratorUsingCrsp2D3DsResults).GetFeatureModel3DResults()[N].

If (Cog3DModelFeatureGeneratorUsingCrsp2D3DsResults).GetFeatureModel3DResults()[i].IsFound is false, it means that there was not enough information in the crsp2D3DsForAllPartPoses to generate 3D model feature[i].

Exceptions

ExceptionCondition
ArgumentNullException If any of the input arguments are null, or any input argument includes a null item with the exception that the FeatureRaw2D member of a crsp2D3D can be null.
ArgumentException
  • If raw2DFromPhys3Ds.Count is less than 2;
  • If crsp2D3DsForAllPartPoses[i] includes duplicate items with the same CameraIndex, the same PartInstanceIndex, and corresponding to the same model point;
  • If crsp2D3DsForAllPartPoses[i][j]. PartInstanceIndex is not 0;
  • If crsp2D3DsForAllPartPoses[i][j].CameraIndex is not inside range [0, raw2DFromPhys3Ds.Count-1];
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is not Cog3DVect3, Cog3DLine, Cog3DLineSeg, Cog3DCylinder, or Cog3DCircle;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is Cog3DVect3, but crsp2D3DsForAllPartPoses[i][j].Subfeature is not Cog3DSubfeatureConstants.Point0;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is Cog3DLine or Cog3DLineSeg, but crsp2D3DsForAllPartPoses[i][j].Subfeature is not Cog3DSubfeatureConstants.StraightEdge0;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is Cog3DCircle, but crsp2D3DsForAllPartPoses[i][j].Subfeature is not Cog3DSubfeatureConstants.CircleEdge0 or Cog3DSubfeatureConstants.Point0;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is Cog3DCylinder, but crsp2D3DsForAllPartPoses[i][j].Subfeature is not Cog3DSubfeatureConstants.OccludingEdge0, .OccludingEdge1, .CircularEdge0, or .CircularEdge1;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureRaw2D is not null, and its type is not Cog3DVect2, or Cog3DVect2Collection;
  • If crsp2D3DsForAllPartPoses[i][j].FeatureModel3DType is Cog3DVect3, crsp2D3DsForAllPartPoses[i][j].FeatureRaw2D has type of Cog3DVect2Collection, and its size is greater than 1.
Remarks

The crsp2D3DsForAllPartPoses should be created by placing a single part under your cameras and simultaneously acquiring images of the one part from all the cameras. This set of images constitutes a "part pose". You should create several part poses of your part, see the Best Practices listed below for details. Providing multiple part poses improves the accuracy of the generated 3D model features.

After collecting the part poses (sets of images of the part), you need to extract the crsp2D3Ds from each of them. For each part pose, extract the crsp2D3Ds from the images of the part pose and put them into a List. The List of crsp2D3Ds from each part pose is then placed in another List thereby creating crsp2D3DsForAllPartPoses which is indexed as crsp2D3DsForAllPartPoses[partPoseIndex][crspIndex].

The 3D model features in the returned results object are in the Model3D coordinate space. The Model3D coordinate space is defined in part pose 0 or crsp2D3DsForAllPartPoses[0] i.e. the pose of the Phys3D origin in part pose 0 will be used to define the origin of the part's 3D coordinate space - Model3D. Thus, the pose of the part (the transform from Model3D space to Phys3D space) in crsp2D3DsForAllPartPoses[0] is the identity transform.

If crsp2D3DsForAllPartPoses[i][j].FeatureRaw2D is null or empty, then crsp2D3DsForAllPartPoses[i][j] is ignored during model feature generation.

All the specified camera calibrations must refer to the same Phys3D coordinate space.

Best Practices for Generating 3D Model Features:

  • The FOV must contain a single part.
  • Use the 5 part poses described below when creating crsp2D3DsForAllPartPoses.
    • Pose 0: Place the part as close as possible to the origin of Phys3D, use a z rotation of 0 degrees. Note that the origin of the Model3D coordinate space (the coordinate space all your 3D model features are defined in) is defined by the Phys3D origin in this pose.
    • Pose 1: Place the part in the upper left corner of FOV visible by both cameras, use a z rotation of ~20 degrees.
    • Pose 2: Place the part in the upper right corner of FOV visible by both cameras, use a z rotation of ~45 degrees.
    • Pose 3: Place the part in the lower left corner of FOV visible by both cameras, use a z rotation of ~67 degrees.
    • Pose 4: Place the part in the lower right corner of FOV visible by both cameras, use a z rotation of ~90 degrees.
  • Verify the IsFound and the residuals in GetFeatureModel3DResults() from the returned results object are acceptable for your 3D model.
See Also