2026-01-26 15:57:19 +08:00
|
|
|
|
// BQ_workpieceCornerExtract_test.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include <VZNL_Types.h>
|
|
|
|
|
|
#include "direct.h"
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include "workpieceHolePositioning_Export.h"
|
|
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
#include <limits>
|
2026-02-02 07:56:51 +08:00
|
|
|
|
#include "SG_baseAlgo_Export.h"
|
2026-01-26 15:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
|
{
|
|
|
|
|
|
int r;
|
|
|
|
|
|
int g;
|
|
|
|
|
|
int b;
|
|
|
|
|
|
}SG_color;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
|
{
|
|
|
|
|
|
int nPointIdx;
|
|
|
|
|
|
double x;
|
|
|
|
|
|
double y;
|
|
|
|
|
|
double z;
|
|
|
|
|
|
float r;
|
|
|
|
|
|
float g;
|
|
|
|
|
|
float b;
|
|
|
|
|
|
} SPointXYZRGB;
|
|
|
|
|
|
|
|
|
|
|
|
void vzReadLaserScanPointFromFile_XYZ_vector(const char* fileName, std::vector<std::vector< SVzNL3DPosition>>& scanData)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::ifstream inputFile(fileName);
|
|
|
|
|
|
std::string linedata;
|
|
|
|
|
|
|
|
|
|
|
|
if (inputFile.is_open() == false)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector< SVzNL3DPosition> a_line;
|
|
|
|
|
|
int ptIdx = 0;
|
|
|
|
|
|
while (getline(inputFile, linedata))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (0 == strncmp("Line_", linedata.c_str(), 5))
|
|
|
|
|
|
{
|
|
|
|
|
|
int ptSize = (int)a_line.size();
|
|
|
|
|
|
if (ptSize > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
scanData.push_back(a_line);
|
|
|
|
|
|
}
|
|
|
|
|
|
a_line.clear();
|
|
|
|
|
|
ptIdx = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (0 == strncmp("{", linedata.c_str(), 1))
|
|
|
|
|
|
{
|
|
|
|
|
|
float X, Y, Z;
|
|
|
|
|
|
int imageY = 0;
|
|
|
|
|
|
float leftX, leftY;
|
|
|
|
|
|
float rightX, rightY;
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "{%f,%f,%f}-{%f,%f}-{%f,%f}", &X, &Y, &Z, &leftX, &leftY, &rightX, &rightY);
|
|
|
|
|
|
SVzNL3DPosition a_pt;
|
|
|
|
|
|
a_pt.pt3D.x = X;
|
|
|
|
|
|
a_pt.pt3D.y = Y;
|
|
|
|
|
|
a_pt.pt3D.z = Z;
|
|
|
|
|
|
a_pt.nPointIdx = ptIdx;
|
|
|
|
|
|
ptIdx++;
|
|
|
|
|
|
a_line.push_back(a_pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//last line
|
|
|
|
|
|
int ptSize = (int)a_line.size();
|
|
|
|
|
|
if (ptSize > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
scanData.push_back(a_line);
|
|
|
|
|
|
a_line.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inputFile.close();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _outputScanDataFile_XYZ_vector(char* fileName, std::vector<std::vector< SVzNL3DPosition>>& scanData)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::ofstream sw(fileName);
|
|
|
|
|
|
int lineNum = scanData.size();
|
|
|
|
|
|
sw << "LineNum:" << lineNum << std::endl;
|
|
|
|
|
|
sw << "DataType: 0" << std::endl;
|
|
|
|
|
|
sw << "ScanSpeed: 0" << std::endl;
|
|
|
|
|
|
sw << "PointAdjust: 1" << std::endl;
|
|
|
|
|
|
sw << "MaxTimeStamp: 0_0" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
for (int line = 0; line < lineNum; line++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int nPositionCnt = scanData[line].size();
|
|
|
|
|
|
sw << "Line_" << line << "_0_" << nPositionCnt << std::endl;
|
|
|
|
|
|
for (int i = 0; i < nPositionCnt; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SVzNL3DPosition* pt3D = &scanData[line][i];
|
|
|
|
|
|
float x = (float)pt3D->pt3D.x;
|
|
|
|
|
|
float y = (float)pt3D->pt3D.y;
|
|
|
|
|
|
float z = (float)pt3D->pt3D.z;
|
|
|
|
|
|
char str[250];
|
|
|
|
|
|
sprintf_s(str, "{ %f, %f, %f } - { 0, 0 } - { 0, 0 }", x, y, z);
|
|
|
|
|
|
|
|
|
|
|
|
sw << str << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
sw.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _outputCalibPara(char* fileName, SSG_planeCalibPara calibPara)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::ofstream sw(fileName);
|
|
|
|
|
|
char dataStr[250];
|
|
|
|
|
|
//调平矩阵
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.planeCalib[0], calibPara.planeCalib[1], calibPara.planeCalib[2]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.planeCalib[3], calibPara.planeCalib[4], calibPara.planeCalib[5]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.planeCalib[6], calibPara.planeCalib[7], calibPara.planeCalib[8]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
//地面高度
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g", calibPara.planeHeight);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
//反向旋转矩阵
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.invRMatrix[0], calibPara.invRMatrix[1], calibPara.invRMatrix[2]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.invRMatrix[3], calibPara.invRMatrix[4], calibPara.invRMatrix[5]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
sprintf_s(dataStr, 250, "%g, %g, %g", calibPara.invRMatrix[6], calibPara.invRMatrix[7], calibPara.invRMatrix[8]);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
sw.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _outputWorkpieceInfo(char* fileName, std::vector< WD_workpieceInfo>& workpiecePositioning)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::ofstream sw(fileName);
|
|
|
|
|
|
char dataStr[250];
|
|
|
|
|
|
|
|
|
|
|
|
int number = (int)workpiecePositioning.size();
|
|
|
|
|
|
for (int i = 0; i < number; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
sprintf_s(dataStr, 250, "工件_%d", i + 1);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
int holeNumber = (int)workpiecePositioning[i].holes.size();
|
|
|
|
|
|
for (int j = 0; j < holeNumber; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
sprintf_s(dataStr, 250, " 孔%d: (%g, %g, %g)", (j+1), workpiecePositioning[i].holes[j].x, workpiecePositioning[i].holes[j].y, workpiecePositioning[i].holes[j].z);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
sprintf_s(dataStr, 50, " center: (%g, %g, %g)", workpiecePositioning[i].center.x, workpiecePositioning[i].center.y, workpiecePositioning[i].center.z);
|
|
|
|
|
|
sw << dataStr << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
sw.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _outputScanDataFile_vector(char* fileName, std::vector<std::vector<SVzNL3DPosition>>& scanLines, bool removeZeros, int* headNullLines)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::ofstream sw(fileName);
|
|
|
|
|
|
int lineNum = (int)scanLines.size();
|
|
|
|
|
|
if (lineNum == 0)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
sw << "LineNum:" << lineNum << std::endl;
|
|
|
|
|
|
sw << "DataType: 0" << std::endl;
|
|
|
|
|
|
sw << "ScanSpeed: 0" << std::endl;
|
|
|
|
|
|
sw << "PointAdjust: 1" << std::endl;
|
|
|
|
|
|
sw << "MaxTimeStamp: 0_0" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
int lineIdx = 0;
|
|
|
|
|
|
int null_lines = 0;
|
|
|
|
|
|
bool counterNull = true;
|
|
|
|
|
|
for (int line = 0; line < lineNum; line++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int linePtNum = (int)scanLines[line].size();
|
|
|
|
|
|
if (linePtNum == 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (true == removeZeros)
|
|
|
|
|
|
{
|
|
|
|
|
|
int vldPtNum = 0;
|
|
|
|
|
|
for (int i = 0; i < linePtNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (scanLines[line][i].pt3D.z > 1e-4)
|
|
|
|
|
|
vldPtNum++;
|
|
|
|
|
|
}
|
|
|
|
|
|
linePtNum = vldPtNum;
|
|
|
|
|
|
}
|
|
|
|
|
|
sw << "Line_" << lineIdx << "_0_" << linePtNum << std::endl;
|
|
|
|
|
|
lineIdx++;
|
|
|
|
|
|
bool isNull = true;
|
|
|
|
|
|
for (int i = 0; i < linePtNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SVzNL3DPoint* pt3D = &scanLines[line][i].pt3D;
|
|
|
|
|
|
if ((pt3D->z > 1e-4) && (isNull == true))
|
|
|
|
|
|
isNull = false;
|
|
|
|
|
|
if ((true == removeZeros) && (pt3D->z < 1e-4))
|
|
|
|
|
|
continue;
|
|
|
|
|
|
float x = (float)pt3D->x;
|
|
|
|
|
|
float y = (float)pt3D->y;
|
|
|
|
|
|
float z = (float)pt3D->z;
|
|
|
|
|
|
sw << "{ " << x << "," << y << "," << z << " }-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}" << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (true == counterNull)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (true == isNull)
|
|
|
|
|
|
null_lines++;
|
|
|
|
|
|
else
|
|
|
|
|
|
counterNull = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
*headNullLines = null_lines;
|
|
|
|
|
|
sw.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SSG_planeCalibPara _readCalibPara(char* fileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
//设置初始结果
|
|
|
|
|
|
double initCalib[9] = {
|
|
|
|
|
|
1.0, 0.0, 0.0,
|
|
|
|
|
|
0.0, 1.0, 0.0,
|
|
|
|
|
|
0.0, 0.0, 1.0 };
|
|
|
|
|
|
SSG_planeCalibPara planePara;
|
|
|
|
|
|
for (int i = 0; i < 9; i++)
|
|
|
|
|
|
planePara.planeCalib[i] = initCalib[i];
|
|
|
|
|
|
planePara.planeHeight = -1.0;
|
|
|
|
|
|
for (int i = 0; i < 9; i++)
|
|
|
|
|
|
planePara.invRMatrix[i] = initCalib[i];
|
|
|
|
|
|
|
|
|
|
|
|
std::ifstream inputFile(fileName);
|
|
|
|
|
|
std::string linedata;
|
|
|
|
|
|
|
|
|
|
|
|
if (inputFile.is_open() == false)
|
|
|
|
|
|
return planePara;
|
|
|
|
|
|
|
|
|
|
|
|
//调平矩阵
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.planeCalib[0], &planePara.planeCalib[1], &planePara.planeCalib[2]);
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.planeCalib[3], &planePara.planeCalib[4], &planePara.planeCalib[5]);
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.planeCalib[6], &planePara.planeCalib[7], &planePara.planeCalib[8]);
|
|
|
|
|
|
//地面高度
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf", &planePara.planeHeight);
|
|
|
|
|
|
//反向旋转矩阵
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.invRMatrix[0], &planePara.invRMatrix[1], &planePara.invRMatrix[2]);
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.invRMatrix[3], &planePara.invRMatrix[4], &planePara.invRMatrix[5]);
|
|
|
|
|
|
std::getline(inputFile, linedata);
|
|
|
|
|
|
sscanf_s(linedata.c_str(), "%lf, %lf, %lf", &planePara.invRMatrix[6], &planePara.invRMatrix[7], &planePara.invRMatrix[8]);
|
|
|
|
|
|
|
|
|
|
|
|
inputFile.close();
|
|
|
|
|
|
return planePara;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _outputRGBDResult_RGBD(
|
|
|
|
|
|
char* fileName,
|
|
|
|
|
|
std::vector<std::vector<SVzNL3DPosition>>& scanLines,
|
|
|
|
|
|
std::vector< WD_workpieceInfo>& workpiecePositioning)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<SVzNL3DPosition> objects;
|
|
|
|
|
|
int objNumber = (int)workpiecePositioning.size();
|
|
|
|
|
|
for (int i = 0; i < objNumber; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SVzNL3DPosition a_objPt;
|
|
|
|
|
|
int holeNumber = (int)workpiecePositioning[i].holes.size();
|
|
|
|
|
|
for (int j = 0; j < holeNumber; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
a_objPt.nPointIdx = i + 1;
|
|
|
|
|
|
a_objPt.pt3D = workpiecePositioning[i].holes[j];
|
|
|
|
|
|
objects.push_back(a_objPt);
|
|
|
|
|
|
}
|
2026-01-26 22:36:13 +08:00
|
|
|
|
a_objPt.pt3D = workpiecePositioning[i].center;
|
2026-01-26 15:57:19 +08:00
|
|
|
|
objects.push_back(a_objPt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int lineNum = (int)scanLines.size();
|
|
|
|
|
|
std::ofstream sw(fileName);
|
|
|
|
|
|
int realLines = (objNumber == 0) ? lineNum : (lineNum + 1);
|
|
|
|
|
|
sw << "LineNum:" << realLines << std::endl;
|
|
|
|
|
|
sw << "DataType: 0" << std::endl;
|
|
|
|
|
|
sw << "ScanSpeed: 0" << std::endl;
|
|
|
|
|
|
sw << "PointAdjust: 1" << std::endl;
|
|
|
|
|
|
sw << "MaxTimeStamp: 0_0" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
int maxLineIndex = 0;
|
|
|
|
|
|
int max_stamp = 0;
|
|
|
|
|
|
SG_color rgb = { 0, 0, 0 };
|
|
|
|
|
|
SG_color objColor[8] = {
|
|
|
|
|
|
{245,222,179},//淡黄色
|
|
|
|
|
|
{210,105, 30},//巧克力色
|
|
|
|
|
|
{240,230,140},//黄褐色
|
|
|
|
|
|
{135,206,235},//天蓝色
|
|
|
|
|
|
{250,235,215},//古董白
|
|
|
|
|
|
{189,252,201},//薄荷色
|
|
|
|
|
|
{221,160,221},//梅红色
|
|
|
|
|
|
{188,143,143},//玫瑰红色
|
|
|
|
|
|
};
|
|
|
|
|
|
int size = 1;
|
|
|
|
|
|
int lineIdx = 0;
|
|
|
|
|
|
for (int line = 0; line < lineNum; line++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int linePtNum = (int)scanLines[line].size();
|
|
|
|
|
|
if (linePtNum == 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
sw << "Line_" << lineIdx << "_0_" << linePtNum << std::endl;
|
|
|
|
|
|
lineIdx++;
|
|
|
|
|
|
for (int i = 0; i < linePtNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SVzNL3DPosition* pt3D = &scanLines[line][i];
|
|
|
|
|
|
if (pt3D->nPointIdx > 0)
|
|
|
|
|
|
int kkk = 1;
|
|
|
|
|
|
int featureType_v = pt3D->nPointIdx & 0xff;
|
|
|
|
|
|
int featureType_h = featureType_v >> 4;
|
|
|
|
|
|
featureType_v &= 0x0f;
|
|
|
|
|
|
|
|
|
|
|
|
if (pt3D->nPointIdx == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
rgb = { 255, 97, 0 };
|
|
|
|
|
|
size = 5;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
rgb = { 200, 200, 200 };
|
|
|
|
|
|
size = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
float x = (float)pt3D->pt3D.x;
|
|
|
|
|
|
float y = (float)pt3D->pt3D.y;
|
|
|
|
|
|
float z = (float)pt3D->pt3D.z;
|
|
|
|
|
|
sw << "{" << x << "," << y << "," << z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << rgb.r << "," << rgb.g << "," << rgb.b << "," << size << " }" << std::endl;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int linePtNum = (int)objects.size();
|
|
|
|
|
|
sw << "Line_" << lineNum << "_0_" << linePtNum + 1 << std::endl;
|
|
|
|
|
|
lineNum++;
|
2026-01-26 22:36:13 +08:00
|
|
|
|
size = 10;
|
2026-01-26 15:57:19 +08:00
|
|
|
|
for (int i = 0; i < linePtNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int colorIdx = objects[i].nPointIdx % 8;
|
|
|
|
|
|
rgb = objColor[colorIdx];
|
|
|
|
|
|
float x = (float)objects[i].pt3D.x;
|
|
|
|
|
|
float y = (float)objects[i].pt3D.y;
|
|
|
|
|
|
float z = (float)objects[i].pt3D.z;
|
|
|
|
|
|
sw << "{" << x << "," << y << "," << z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << rgb.r << "," << rgb.g << "," << rgb.b << "," << size << " }" << std::endl;
|
|
|
|
|
|
}
|
2026-01-26 22:36:13 +08:00
|
|
|
|
//修正显示软件bug
|
|
|
|
|
|
rgb = objColor[1];
|
|
|
|
|
|
float x = (float)objects[0].pt3D.x;
|
|
|
|
|
|
float y = (float)objects[0].pt3D.y;
|
|
|
|
|
|
float z = (float)objects[0].pt3D.z;
|
|
|
|
|
|
sw << "{" << x << "," << y << "," << z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << rgb.r << "," << rgb.g << "," << rgb.b << "," << size << " }" << std::endl;
|
2026-01-26 15:57:19 +08:00
|
|
|
|
//输出方向线条
|
2026-01-26 22:36:13 +08:00
|
|
|
|
rgb = { 255, 0, 0 };
|
|
|
|
|
|
size = 2;
|
|
|
|
|
|
for (int i = 0; i < objNumber; i++)
|
|
|
|
|
|
{
|
2026-02-01 15:25:55 +08:00
|
|
|
|
SVzNL3DPoint dirPt;
|
|
|
|
|
|
dirPt = { workpiecePositioning[i].center.x + workpiecePositioning[i].y_dir.x * 10,
|
|
|
|
|
|
workpiecePositioning[i].center.y + workpiecePositioning[i].y_dir.y * 10,
|
|
|
|
|
|
workpiecePositioning[i].center.z + workpiecePositioning[i].y_dir.z * 10 };
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "Poly_" << lineIdx << "_2" << std::endl;
|
|
|
|
|
|
sw << "{" << workpiecePositioning[i].center.x << "," << workpiecePositioning[i].center.y << "," << workpiecePositioning[i].center.z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
2026-02-01 15:25:55 +08:00
|
|
|
|
sw << "{" << dirPt.x << "," << dirPt.y << "," << dirPt.z << "}-";
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
|
|
|
|
|
lineIdx++;
|
|
|
|
|
|
|
2026-02-01 15:25:55 +08:00
|
|
|
|
dirPt = { workpiecePositioning[i].center.x + workpiecePositioning[i].z_dir.x * 10,
|
|
|
|
|
|
workpiecePositioning[i].center.y + workpiecePositioning[i].z_dir.y * 10,
|
|
|
|
|
|
workpiecePositioning[i].center.z + workpiecePositioning[i].z_dir.z * 10 };
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "Poly_" << lineIdx << "_2" << std::endl;
|
|
|
|
|
|
sw << "{" << workpiecePositioning[i].center.x << "," << workpiecePositioning[i].center.y << "," << workpiecePositioning[i].center.z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
2026-02-01 15:25:55 +08:00
|
|
|
|
sw << "{" << dirPt.x << "," << dirPt.y << "," << dirPt.z << "}-";
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
|
|
|
|
|
lineIdx++;
|
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < (int)workpiecePositioning[i].holes.size(); j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
sw << "Poly_" << lineIdx << "_2" << std::endl;
|
|
|
|
|
|
sw << "{" << workpiecePositioning[i].holes[j].x << "," << workpiecePositioning[i].holes[j].y << "," << workpiecePositioning[i].holes[j].z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
|
|
|
|
|
sw << "{" << workpiecePositioning[i].holesDir[j].x << "," << workpiecePositioning[i].holesDir[j].y << "," << workpiecePositioning[i].holesDir[j].z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
|
|
|
|
|
lineIdx++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-01 15:25:55 +08:00
|
|
|
|
SVzNL3DPoint dirPt = { workpiecePositioning[0].center.x + workpiecePositioning[0].y_dir.x * 10,
|
|
|
|
|
|
workpiecePositioning[0].center.y + workpiecePositioning[0].y_dir.y * 10,
|
|
|
|
|
|
workpiecePositioning[0].center.z + workpiecePositioning[0].y_dir.z * 10 };
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "Poly_" << lineIdx << "_2" << std::endl;
|
|
|
|
|
|
sw << "{" << workpiecePositioning[0].center.x << "," << workpiecePositioning[0].center.y << "," << workpiecePositioning[0].center.z << "}-";
|
|
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
2026-02-01 15:25:55 +08:00
|
|
|
|
sw << "{" << dirPt.x << "," << dirPt.y << "," << dirPt.z << "}-";
|
2026-01-26 22:36:13 +08:00
|
|
|
|
sw << "{0,0}-{0,0}-";
|
|
|
|
|
|
sw << "{" << (int)rgb.r << "," << (int)rgb.g << "," << (int)rgb.b << "," << size << "}" << std::endl;
|
|
|
|
|
|
|
2026-01-26 15:57:19 +08:00
|
|
|
|
sw.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SVzNL3DPoint _pointRT(SVzNL3DPoint& origin, const double* R, const double* T)
|
|
|
|
|
|
{
|
|
|
|
|
|
SVzNL3DPoint result;
|
|
|
|
|
|
result.x = origin.x * R[0] + origin.y * R[1] + origin.z * R[2];
|
|
|
|
|
|
result.y = origin.x * R[3] + origin.y * R[4] + origin.z * R[5];
|
|
|
|
|
|
result.z = origin.x * R[6] + origin.y * R[7] + origin.z * R[8];
|
|
|
|
|
|
result.x += T[0];
|
|
|
|
|
|
result.y += T[1];
|
|
|
|
|
|
result.z += T[2];
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define TEST_COMPUTE_CALIB_PARA 0
|
2026-02-02 07:56:51 +08:00
|
|
|
|
#define TEST_COMPUTE_HOLE 0
|
|
|
|
|
|
#define TEST_COMPUTE_RT 1
|
2026-01-26 15:57:19 +08:00
|
|
|
|
#define TEST_GROUP 1
|
|
|
|
|
|
int main()
|
|
|
|
|
|
{
|
|
|
|
|
|
const char* dataPath[TEST_GROUP] = {
|
|
|
|
|
|
|
|
|
|
|
|
"F:/ShangGu/项目/冠钦项目/拓普发工件孔定位/拓普发点云/", //0
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SVzNLRange fileIdx[TEST_GROUP] = {
|
2026-02-01 15:25:55 +08:00
|
|
|
|
{5,5},
|
2026-01-26 15:57:19 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const char* ver = wd_workpieceHolePositioningVersion();
|
|
|
|
|
|
printf("ver:%s\n", ver);
|
|
|
|
|
|
|
2026-02-02 07:56:51 +08:00
|
|
|
|
#if TEST_COMPUTE_RT
|
|
|
|
|
|
std::vector<cv::Point3d> pts_eye;
|
|
|
|
|
|
pts_eye.resize(6);
|
|
|
|
|
|
std::vector<cv::Point3d> pts_robot;
|
|
|
|
|
|
pts_robot.resize(6);
|
|
|
|
|
|
pts_eye[0] = { 187.22, -99.43, 1797.70 }; //, R = 0.6413, P = 0.0302, Y = -91.1494
|
|
|
|
|
|
pts_eye[1] = { 186.50, -140.52, 1797.69 }; // R = 0.6413, P = 0.0302, Y = -88.8130
|
|
|
|
|
|
pts_eye[2] = { 256.73, -93.55, 1797.83 }; //, R = 0.6413, P = 0.0302, Y = -89.3432
|
|
|
|
|
|
pts_eye[3] = { 236.69, -48.82, 1797.77 }; // R = 0.6413, P = 0.0302, Y = -89.5285
|
|
|
|
|
|
pts_eye[4] = { 173.62, 13.92, 1797.30 };// R = 0.6413, P = 0.0302, Y = -89.6450
|
|
|
|
|
|
pts_eye[5] = { 232.11, -153.38, 1797.88 };// R = 0.6413, P = 0.0302, Y = -82.0278
|
|
|
|
|
|
|
|
|
|
|
|
//A:绕z, B:绕y, C:绕x
|
|
|
|
|
|
pts_robot[0] = { 55.830, -984.472, 97.687 }; // A:0.018 B : -0.638 C : -0.292
|
|
|
|
|
|
pts_robot[1] = { 95.469, -985.345, 97.782 }; // A:-1.032 B : -0.354 C : 1.001
|
|
|
|
|
|
pts_robot[2] = { 47.908, -1053.709, 97.802 }; // A:-1.032 B : -0.356 C : 0.998
|
|
|
|
|
|
pts_robot[3] = { 3.646, -1033.152, 96.494 }; // A:-1.028 B : -0.367 C : 0.442
|
|
|
|
|
|
pts_robot[4] = { -58.843, -969.793, 95.297 }; // A:-1.029 B : -0.367 C : 0.442
|
|
|
|
|
|
pts_robot[5] = { 108.031, -1029.803, 98.333 }; // A:-9.208 B : -0.367 C : 0.442
|
|
|
|
|
|
|
|
|
|
|
|
std::vector< cv::Point3d> rpy_eye;
|
|
|
|
|
|
rpy_eye.resize(6);
|
|
|
|
|
|
std::vector< cv::Point3d> rpy_robot;
|
|
|
|
|
|
rpy_robot.resize(6);
|
|
|
|
|
|
rpy_eye[0] = { 0.6413, 0.0302, -91.1494 };
|
|
|
|
|
|
rpy_eye[1] = { 0.6413, 0.0302, -88.8130 };
|
|
|
|
|
|
rpy_eye[2] = { 0.6413, 0.0302, -89.3432 };
|
|
|
|
|
|
rpy_eye[3] = { 0.6413, 0.0302, -89.5285 };
|
|
|
|
|
|
rpy_eye[4] = { 0.6413, 0.0302, -89.6450 };
|
|
|
|
|
|
rpy_eye[5] = { 0.6413, 0.0302, -82.0278 };
|
|
|
|
|
|
|
|
|
|
|
|
rpy_robot[0] = { -0.292, -0.638, 0.018 }; // A:0.018 B : -0.638 C : -0.292
|
|
|
|
|
|
rpy_robot[1] = { 1.001, -0.354, -1.032 }; // A:-1.032 B : -0.354 C : 1.001
|
|
|
|
|
|
rpy_robot[2] = { 0.998, -0.356, -1.032 }; // A:-1.032 B : -0.356 C : 0.998
|
|
|
|
|
|
rpy_robot[3] = { 0.442, -0.367,-1.028 }; // A:-1.028 B :-0.367 C : 0.442
|
|
|
|
|
|
rpy_robot[4] = { 0.442, -0.367, -1.029 }; // A:-1.029 B : -0.367 C : 0.442
|
|
|
|
|
|
rpy_robot[5] = { 0.442, -0.367, -9.208 }; // A:-9.208 B : -0.367 C : 0.442
|
|
|
|
|
|
|
|
|
|
|
|
//使用前5组数据
|
|
|
|
|
|
std::vector<cv::Point3d> test_pts_eye;
|
|
|
|
|
|
std::vector<cv::Point3d> test_pts_robot;
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
test_pts_eye.push_back(pts_eye[i]);
|
|
|
|
|
|
test_pts_robot.push_back(pts_robot[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
//对空间两组对应点计算旋转平移矩阵
|
|
|
|
|
|
// Eigen库实现
|
|
|
|
|
|
cv::Mat R, T;
|
|
|
|
|
|
cv::Point3d C_eye, C_robot;
|
|
|
|
|
|
caculateRT(
|
|
|
|
|
|
test_pts_eye,
|
|
|
|
|
|
test_pts_robot,
|
|
|
|
|
|
R, T,
|
|
|
|
|
|
C_eye, C_robot);
|
|
|
|
|
|
|
|
|
|
|
|
cv::Point3d rtPt;
|
|
|
|
|
|
pointRT_2(R, T, pts_eye[5], rtPt); //RT前后的点
|
|
|
|
|
|
//根据欧拉角计算方向向量
|
|
|
|
|
|
std::vector<cv::Point3d> vectors;
|
|
|
|
|
|
|
|
|
|
|
|
double rpy[3] = { rpy_eye[5].x, rpy_eye[5].y, rpy_eye[5].z };
|
|
|
|
|
|
std::vector<cv::Point3d> dirVectors_eye;
|
|
|
|
|
|
WD_EulerRpyToDirVectors(rpy, dirVectors_eye);
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<cv::Point3d> dirVectors_robot;
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
cv::Point3d rt_pt;
|
|
|
|
|
|
pointRotate(R, dirVectors_eye[i], rt_pt);
|
|
|
|
|
|
dirVectors_robot.push_back(rt_pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
//dirVectors_robot[0] = { -dirVectors_robot[0].x, dirVectors_robot[0].y, dirVectors_robot[0].z };
|
|
|
|
|
|
dirVectors_robot[1] = { -dirVectors_robot[1].x, dirVectors_robot[1].y, dirVectors_robot[1].z };
|
|
|
|
|
|
dirVectors_robot[2] = { -dirVectors_robot[2].x, dirVectors_robot[2].y, dirVectors_robot[2].z };
|
|
|
|
|
|
|
|
|
|
|
|
//生成旋转矩阵
|
|
|
|
|
|
double R_pose[3][3];
|
|
|
|
|
|
R_pose[0][0] = dirVectors_robot[0].x;
|
|
|
|
|
|
R_pose[0][1] = dirVectors_robot[1].x;
|
|
|
|
|
|
R_pose[0][2] = dirVectors_robot[2].x;
|
|
|
|
|
|
R_pose[1][0] = dirVectors_robot[0].y;
|
|
|
|
|
|
R_pose[1][1] = dirVectors_robot[1].y;
|
|
|
|
|
|
R_pose[1][2] = dirVectors_robot[2].y;
|
|
|
|
|
|
R_pose[2][0] = dirVectors_robot[0].z;
|
|
|
|
|
|
R_pose[2][1] = dirVectors_robot[1].z;
|
|
|
|
|
|
R_pose[2][2] = dirVectors_robot[2].z;
|
|
|
|
|
|
SSG_EulerAngles test_rpy = rotationMatrixToEulerZYX(R_pose);
|
|
|
|
|
|
#endif
|
2026-01-26 15:57:19 +08:00
|
|
|
|
#if TEST_COMPUTE_CALIB_PARA
|
|
|
|
|
|
char _calib_datafile[256];
|
2026-02-02 07:56:51 +08:00
|
|
|
|
sprintf_s(_calib_datafile, "%sLaserData_ground2.txt", dataPath[0]);
|
2026-01-26 15:57:19 +08:00
|
|
|
|
int lineNum = 0;
|
|
|
|
|
|
float lineV = 0.0f;
|
|
|
|
|
|
int dataCalib = 0;
|
|
|
|
|
|
int maxTimeStamp = 0;
|
|
|
|
|
|
int clockPerSecond = 0;
|
|
|
|
|
|
std::vector<std::vector< SVzNL3DPosition>> scanData;
|
|
|
|
|
|
vzReadLaserScanPointFromFile_XYZ_vector(_calib_datafile, scanData);
|
|
|
|
|
|
|
|
|
|
|
|
lineNum = (int)scanData.size();
|
|
|
|
|
|
if (scanData.size() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
SSG_planeCalibPara calibPara = wd_getGroundCalibPara(scanData);
|
|
|
|
|
|
//结果进行验证
|
|
|
|
|
|
for (int i = 0; i < lineNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (i == 14)
|
|
|
|
|
|
int kkk = 1;
|
|
|
|
|
|
//行处理
|
|
|
|
|
|
//调平,去除地面
|
|
|
|
|
|
wd_lineDataR(scanData[i], calibPara.planeCalib, -1);
|
|
|
|
|
|
}
|
|
|
|
|
|
//
|
|
|
|
|
|
char calibFile[250];
|
|
|
|
|
|
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[0]);
|
|
|
|
|
|
_outputCalibPara(calibFile, calibPara);
|
|
|
|
|
|
char _out_file[256];
|
|
|
|
|
|
sprintf_s(_out_file, "%sscanData_ground_calib_verify.txt", dataPath[0]);
|
|
|
|
|
|
int headNullLines = 0;
|
|
|
|
|
|
_outputScanDataFile_vector(_out_file, scanData, false, &headNullLines);
|
2026-02-02 07:56:51 +08:00
|
|
|
|
#if 0
|
2026-01-26 15:57:19 +08:00
|
|
|
|
for (int fidx = fileIdx[0].nMin; fidx <= fileIdx[0].nMax; fidx++)
|
|
|
|
|
|
{
|
|
|
|
|
|
//fidx =4;
|
|
|
|
|
|
char _scan_file[256];
|
|
|
|
|
|
sprintf_s(_scan_file, "%sLaserData_%d.txt", dataPath[0], fidx);
|
|
|
|
|
|
std::vector<std::vector< SVzNL3DPosition>> scanLines;
|
|
|
|
|
|
vzReadLaserScanPointFromFile_XYZ_vector(_scan_file, scanLines);
|
|
|
|
|
|
if (scanLines.size() == 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
lineNum = (int)scanLines.size();
|
|
|
|
|
|
for (int i = 0; i < lineNum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
//调平,去除地面
|
|
|
|
|
|
wd_lineDataR(scanLines[i], calibPara.planeCalib, -1);
|
|
|
|
|
|
}
|
|
|
|
|
|
sprintf_s(_scan_file, "%sLaserData_%d_calib_verify.txt", dataPath[0], fidx);
|
|
|
|
|
|
int headNullLines = 0;
|
|
|
|
|
|
_outputScanDataFile_vector(_scan_file, scanLines, false, &headNullLines);
|
|
|
|
|
|
}
|
2026-02-02 07:56:51 +08:00
|
|
|
|
#endif
|
2026-01-26 15:57:19 +08:00
|
|
|
|
printf("%s: calib done!\n", _calib_datafile);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if TEST_COMPUTE_HOLE
|
|
|
|
|
|
for (int grp = 0; grp <= 0; grp++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SSG_planeCalibPara groundCalibPara;
|
|
|
|
|
|
//初始化成单位阵
|
|
|
|
|
|
groundCalibPara.planeCalib[0] = 1.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[1] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[2] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[3] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[4] = 1.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[5] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[6] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[7] = 0.0;
|
|
|
|
|
|
groundCalibPara.planeCalib[8] = 1.0;
|
|
|
|
|
|
groundCalibPara.planeHeight = -1.0;
|
|
|
|
|
|
for (int i = 0; i < 9; i++)
|
|
|
|
|
|
groundCalibPara.invRMatrix[i] = groundCalibPara.planeCalib[i];
|
|
|
|
|
|
char calibFile[250];
|
|
|
|
|
|
sprintf_s(calibFile, "%sground_calib_para.txt", dataPath[grp]);
|
2026-02-01 15:25:55 +08:00
|
|
|
|
//groundCalibPara = _readCalibPara(calibFile);
|
2026-01-26 15:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
|
|
|
|
|
{
|
|
|
|
|
|
//fidx =4;
|
|
|
|
|
|
char _scan_file[256];
|
|
|
|
|
|
sprintf_s(_scan_file, "%sLaserData_%d.txt", dataPath[grp], fidx);
|
|
|
|
|
|
std::vector<std::vector< SVzNL3DPosition>> scanLines;
|
|
|
|
|
|
vzReadLaserScanPointFromFile_XYZ_vector(_scan_file, scanLines);
|
|
|
|
|
|
if (scanLines.size() == 0)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
long t1 = (long)GetTickCount64();//统计时间
|
|
|
|
|
|
|
|
|
|
|
|
SSG_lineSegParam lineSegPara;
|
|
|
|
|
|
lineSegPara.distScale = 3.0;
|
|
|
|
|
|
lineSegPara.segGapTh_y = 3.0; //y方向间隔大于5mm认为是分段
|
|
|
|
|
|
lineSegPara.segGapTh_z = 10.0; //z方向间隔大于10mm认为是分段
|
|
|
|
|
|
SSG_outlierFilterParam filterParam;
|
|
|
|
|
|
filterParam.continuityTh = 20.0; //噪声滤除。当相邻点的z跳变大于此门限时,检查是否为噪声。若长度小于outlierLen, 视为噪声
|
|
|
|
|
|
filterParam.outlierTh = 5;
|
|
|
|
|
|
SSG_treeGrowParam growParam;
|
|
|
|
|
|
growParam.maxLineSkipNum = 10;
|
|
|
|
|
|
growParam.yDeviation_max = 10.0;
|
|
|
|
|
|
growParam.maxSkipDistance = 10.0;
|
|
|
|
|
|
growParam.zDeviation_max = 10.0;// algoParam.bagParam.bagH / 2; //袋子高度1/2
|
|
|
|
|
|
growParam.minLTypeTreeLen = 100; //mm
|
|
|
|
|
|
growParam.minVTypeTreeLen = 100; //mm
|
|
|
|
|
|
WD_workpieceHoleParam workpiecePara;
|
|
|
|
|
|
workpiecePara.workpieceType = 0;
|
|
|
|
|
|
workpiecePara.holeDiameter = 6.0; //
|
|
|
|
|
|
workpiecePara.holeDist_W = 32.0;
|
|
|
|
|
|
workpiecePara.holeDist_L = 40.0;
|
|
|
|
|
|
int errCode = 0;
|
|
|
|
|
|
std::vector< WD_workpieceInfo> workpiecePositioning;
|
|
|
|
|
|
wd_workpieceHolePositioning(
|
|
|
|
|
|
scanLines,
|
|
|
|
|
|
workpiecePara,
|
|
|
|
|
|
lineSegPara,
|
|
|
|
|
|
filterParam,
|
|
|
|
|
|
growParam,
|
|
|
|
|
|
groundCalibPara,
|
|
|
|
|
|
workpiecePositioning,
|
|
|
|
|
|
&errCode);
|
|
|
|
|
|
long t2 = (long)GetTickCount64();
|
|
|
|
|
|
printf("%s: %d(ms)!\n", _scan_file, (int)(t2 - t1));
|
|
|
|
|
|
//输出测试结果
|
|
|
|
|
|
sprintf_s(_scan_file, "%sresult\\LaserLine%d_result.txt", dataPath[grp], fidx);
|
|
|
|
|
|
_outputRGBDResult_RGBD(_scan_file, scanLines, workpiecePositioning);
|
|
|
|
|
|
sprintf_s(calibFile, "%sresult\\LaserLine%d_corner_info.txt", dataPath[grp], fidx);
|
|
|
|
|
|
_outputWorkpieceInfo(calibFile, workpiecePositioning);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
|
|
|
|
|
|
// 调试程序: F5 或调试 >“开始调试”菜单
|
|
|
|
|
|
|
|
|
|
|
|
// 入门使用技巧:
|
|
|
|
|
|
// 1. 使用解决方案资源管理器窗口添加/管理文件
|
|
|
|
|
|
// 2. 使用团队资源管理器窗口连接到源代码管理
|
|
|
|
|
|
// 3. 使用输出窗口查看生成输出和其他消息
|
|
|
|
|
|
// 4. 使用错误列表窗口查看错误
|
|
|
|
|
|
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
|
|
|
|
|
|
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
|