Cog3DPartCorresponderUsingCrsp2D3Ds CorrespondPartsUsingPointsAndIntersectionPoints Method Cognex VisionPro
This method determines the part correspondences among the multiple part instances seen by multiple cameras using the original 2D/3D part feature correspondences (crsp2D3Ds), and the camera calibrations. After determining the part correspondences across cameras, generate a result object for each corresponded part instance and a result object for each uncorresponded part instance. Also generate a new set of 2D/3D part feature correspondences (crsp2D3DsUnified) with updated PartInstanceIndex members that map to the returned result objects.

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

public List<Cog3DPartCorresponderUsingCrsp2D3DsResult> CorrespondPartsUsingPointsAndIntersectionPoints(
	List<Cog3DCameraCalibration> raw2DFromPhys3Ds,
	List<Cog3DCrsp2D3D> crsp2D3Ds,
	out List<Cog3DCrsp2D3D> crsp2D3DsUnified
)

Parameters

raw2DFromPhys3Ds
Type: System.Collections.Generic List Cog3DCameraCalibration 
The List of camera calibrations. One calibration per camera. The size of this list specifies the number of cameras. May not be null.
crsp2D3Ds
Type: System.Collections.Generic List Cog3DCrsp2D3D 
The List of the original crsp2D3Ds with associated camera index and original part instance index. May not be null.

Note that if crsp2D3Ds[i].FeatureRaw2D is null or empty, then crsp2D3Ds[i] is ignored when computing the part correspondences.

crsp2D3DsUnified
Type: System.Collections.Generic List Cog3DCrsp2D3D  
This is a copy of crsp2D3Ds where the PartInstanceIndex in crsp2D3DsUnified have been updated to reflect the correct part correspondences across cameras. crsp2D3DsUnified is created by first making a shallow copy of each element in crsp2D3Ds whose (CameraIndex, PartInstance) exists in one item of the returned List of Cog3DPartCorresponderUsingCrsp2D3DsResult, then updating its PartInstanceIndex to be the index of the corresponding item in the returned List of Cog3DPartCorresponderUsingCrsp2D3DsResult, i.e. if (crsp2D3Ds[i].CameraIndex, crsp2D3Ds[i].PartInstanceIndex) exists in the returned List(Cog3DPartCorresponderUsingCrsp2D3DsResult)[j].GetIndicesOfCameraAndPartInstance(), then a shallow copy of crsp2D3Ds[i] will be inside crsp2D3DsUnified and its PartInstanceIndex is modified to be j.

Return Value

Type: List Cog3DPartCorresponderUsingCrsp2D3DsResult 
The List of result objects (Cog3DPartCorresponderUsingCrsp2D3DsResult). Each item contains one 3D part instance's correspondences.

If there are 2 cameras, 10 parts in the scene observed by both cameras, and all the parts are corresponded, then this returned list will include 10 items, one item for each part instance.

If 6 of the parts are corresponded, then this returned list will include 14 items: 6 items for the corresponded parts, 4 items for the uncorresponded parts in camera 0 and 4 items for the uncorresponded parts in camera 1.

Each item includes a dictionary of (key=camera index, value=original 2D part instance index).

Exceptions

ExceptionCondition
ArgumentNullException If crsp2D3Ds or raw2DFromPhys3Ds is null, or any item in one of them is null, or FeaturesModel3D[crsp2D3Ds[i].FeatureModel3DIndex] is null.
ArgumentException
  • If raw2DFromPhys3Ds.Count is less than 2;
  • If crsp2D3Ds includes duplicate items with the same CameraIndex, the same PartInstanceIndex, and corresponding to the same model point (model feature with type Cog3DVect3);
  • If crsp2D3Ds[i].CameraIndex is not inside range [0, raw2DFromPhys3Ds.Count-1];
  • If crsp2D3Ds[i].FeatureModel3DType is not Cog3DVect3, Cog3DLine, Cog3DLineSeg, Cog3DCylinder, or Cog3DCircle;
  • If crsp2D3Ds[i].FeatureModel3DType is Cog3DVect3, but crsp2D3Ds[i].Subfeature is not Cog3DSubfeatureConstants.Point0;
  • If crsp2D3Ds[i].FeatureModel3DType is Cog3DLine or Cog3DLineSeg, but crsp2D3Ds[i].Subfeature is not Cog3DSubfeatureConstants.StraightEdge0;
  • If crsp2D3Ds[i].FeatureModel3DType is Cog3DCircle, but crsp2D3Ds[i].Subfeature is not Cog3DSubfeatureConstants.CircleEdge0 or Cog3DSubfeatureConstants.Point0;
  • If crsp2D3Ds[i].FeatureModel3DType is Cog3DCylinder, but crsp2D3Ds[i].Subfeature is not Cog3DSubfeatureConstants.OccludingEdge0, .OccludingEdge1, .CircularEdge0, or .CircularEdge1;
  • If crsp2D3Ds[i].FeatureRaw2D is not null, and its type is not Cog3DVect2, or Cog3DVect2Collection;
  • If crsp2D3Ds[i].FeatureModel3DType is Cog3DVect3, crsp2D3Ds[i].FeatureRaw2D has type of Cog3DVect2Collection, and its size is greater than 1.
  • If crsp2D3Ds[i].FeatureModel3DIndex is not inside range [0, FeaturesModel3D.Count-1];
  • If crsp2D3Ds[i].FeatureModel3DType is not the same as the type of FeaturesModel3D[crsp2D3Ds[i].FeatureModel3DIndex];
  • If FeaturesModel3D contains less than 3 distinct model points (including derived 3D model points from intersected 3D lines or 3D line segments).
Remarks

If there are 3D lines or 3D line segments in the model, this corresponder internally computes the derived 3D model points from 3D line intersections, and the corresponding derived 2D points from 2D line intersections.

In order for an intersection point to be computed and used, the two line segments/lines in the image must have different directions (difference of the direction angles must be 10 degrees or more), and the nearest distance between the corresponding two 3D line segments/lines must be small enough comparing to the size of the 3D model.

In order for a part instance to be corresponded, at least there are 2 cameras seeing that part instance, and each camera sees at least 3 2D points (including the derived 2D points corresponding to the derived 3D model points).

If this does not happen, then the part instance will not be corresponded.

Note that FeaturesModel3D and crsp2D3Ds[i].FeatureModel3DIndex for any i must be set correctly in order to use this part corresponder. Cog3DModelFeatureGeneratorUsing2D3Ds might be used to generate 3D model features at train time.

See Also