CogCaliperResults GetProjectionValues Method Cognex VisionPro
Projected image values. These are normalized to the range 0 -> 255 and account for any clipping.

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

public double[] GetProjectionValues()

Return Value

Type:  Double 
Remarks

Projected image values. These are normalized to the range 0 -> 255 and account for any clipping.

You can use the values in this array to construct a graphical representation of the projected image.

Examples

Imports Cognex.VisionPro
Imports Cognex.VisionPro.Caliper
Imports Cognex.VisionPro.ImageProcessing

' Working with a CogCaliperTool object
Dim myCaltool As New CogCaliperTool
Dim coDispImage As CogImage8Grey
Dim i As Integer
Dim j As Integer
Dim dblPixelValues() As Double

' You must copy the pixel values into an array before referencing them.
dblPixelValues = myCaltool.Results.GetProjectionValues

' Allocate a new image. Call Allocate to Create Storage for the Pixels
coDispImage = New CogImage8Grey
coDispImage.Allocate(UBound(dblPixelValues) + 1, 40)

' Set each row of the image to be the same.
For i = 0 To 39
  For j = 0 To UBound(dblPixelValues)
    coDispImage.SetPixel(j, i, Convert.ToByte(dblPixelValues(j)))
  Next j
Next
using Cognex.VisionPro;
using Cognex.VisionPro.Caliper;
using Cognex.VisionPro.ImageProcessing;

// Working with a CogCaliperTool object
CogCaliperTool myCaltool = new CogCaliperTool();
CogImage8Grey coDispImage;
int i;
int j;
double[] dblPixelValues;

// You must copy the pixel values into an array before referencing them.
dblPixelValues = myCaltool.Results.GetProjectionValues();

// Allocate a new image. Call Allocate to Create Storage for the Pixels
coDispImage = new CogImage8Grey();
coDispImage.Allocate( (dblPixelValues.GetUpperBound(0)) + 1, 40);

// Set each row of the image to be the same. 
for( i = 0; i <= 39;i++){
  for( j = 0; j <=  dblPixelValues.GetUpperBound(0); j++) {
   coDispImage.SetPixel(j, i, Convert.ToByte(dblPixelValues[j]));
  }
}
See Also