Hi Dietmar,
there is a C# example available that displays the measured rangemap and uses the stamp data to automatically convert it into a pointcloud. However, it is still based on the old CVB 3D tools including the old display and old core3D functionality. After releasing the new 3D tools I will update the Gocator example. In the new CVB 3D functionality there will also be other 3D functions, such as a 3Dcrop with which you can crop points from a point cloud using given limits.
You can download the old example here: 134197-LMIGocatorGenTLExample_CVB2016.zip (254.9 KB)
What you need to do is to convert the stamp data into metric values first:
// FUNCTION: Convert stamp data into metric values (each four 16bit stamp data pixel into one 64 bit stamp data value)
private Int64[] ConvertStampData(Int16[] data)
{
Int64[] stampData = new Int64[15];
Array.Clear(stampData, 0, stampData.Length);
Int64 val1 = 0, val2 = 0, val3 = 0, val4 = 0;
for (int i = 0; i < 60; i += 4)
{
val1 = data[i];
val2 = data[i + 1];
val3 = data[i + 2];
val4 = data[i + 3];
stampData[i / 4] = ((val1 & 0xFFFF) << 48) | ((val2 & 0xFFFF) << 32) | ((val3 & 0xFFFF) << 16) | (val4 & 0xFFFF);
// Computation for x-offset correction (Gocator encodes intensities with int16, but values in .bmp image are stored in uint16)
if (i == 44)
stampData[(i / 4) - 1] = stampData[(i / 4) - 1] + 32768 * stampData[i / 4];
}
return stampData;
}
Then you can calculate the point cloud from the rangemap and metric stamp data values:
//create new metric calibrated cop (with default metric values 1,1,1)
Cvb.Triangulation.Metric3DFactors metric = new Cvb.Triangulation.Metric3DFactors(1, 1, 1);
m_cop = new Cvb.Triangulation.COP3D(m_rangemap, metric);
AddStatusTextToRichBox("COP generated successfully.");
//Create MotionMatrix
float[,] MotionMatrixF = new float[3,4];
MotionMatrixF.SetValue((m_stampData[07] / 1000000f), 0, 0);
MotionMatrixF.SetValue(0, 0, 1);
MotionMatrixF.SetValue(0, 0, 2);
MotionMatrixF.SetValue((m_stampData[06] / 1000000f - 34.5f), 0, 3); // negative offset of 34.5mm needed, reason unclear!
MotionMatrixF.SetValue(0, 1, 0);
MotionMatrixF.SetValue((m_stampData[09] / 1000000f), 1, 1);
MotionMatrixF.SetValue(0, 1, 2);
MotionMatrixF.SetValue((m_stampData[08] / 1000000f + 34.5f), 1, 3); // positive offset of 34.5mm needed, reason unclear!
MotionMatrixF.SetValue(0, 2, 0);
MotionMatrixF.SetValue(0, 2, 1);
MotionMatrixF.SetValue((m_stampData[11] / 1000000f), 2, 2);
MotionMatrixF.SetValue((m_stampData[10] / 1000000f - (m_stampData[11] / 1000000f)*32768), 2, 3);
Cvb.Triangulation.MotionMatrix MotionMatrix = new Cvb.Triangulation.MotionMatrix(MotionMatrixF);