备份备份
This commit is contained in:
@@ -259,7 +259,7 @@ bool Hd_CameraModule_3DKeyence::readData(std::vector<cv::Mat> &mats,QByteArray &
|
||||
}
|
||||
cv::Mat mheightMat2 = cv::Mat();
|
||||
heightMatS.dequeue().copyTo(mheightMat2);
|
||||
cv::Mat mluminanceMat2 = cv::Mat();
|
||||
cv::Mat mluminanceMat2;
|
||||
luminanceMatS.dequeue().copyTo(mluminanceMat2);
|
||||
mats.push_back(mheightMat2.clone());
|
||||
mats.push_back(mluminanceMat2.clone());
|
||||
@@ -317,7 +317,7 @@ bool Hd_CameraModule_3DKeyence::initParas(QByteArray& initData)
|
||||
{
|
||||
QByteArrayList valueList = initData.split('+');
|
||||
camera_name = valueList[0];
|
||||
deviceId = valueList[0].toInt(); //相机头序号
|
||||
//deviceId = valueList[0].toInt(); //相机头序号
|
||||
if (valueList.size() > 1)
|
||||
for (int i = 1; i < valueList.size(); i++)
|
||||
{
|
||||
@@ -351,6 +351,14 @@ bool Hd_CameraModule_3DKeyence::initParas(QByteArray& initData)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (valuei.contains("deviceId"))
|
||||
{
|
||||
QStringList valueL = valuei.split('#');
|
||||
if (valueL.size() == 2)
|
||||
{
|
||||
deviceId = valueL[1].toInt();
|
||||
}
|
||||
}
|
||||
if (valuei.contains("port"))
|
||||
{
|
||||
//port#24691
|
||||
@@ -387,7 +395,7 @@ bool Hd_CameraModule_3DKeyence::initParas(QByteArray& initData)
|
||||
y_pitch_um = valueL[1].toDouble();
|
||||
}
|
||||
}
|
||||
if (valuei.contains("取图超时"))
|
||||
if (valuei.contains("timeout"))
|
||||
{
|
||||
//timeout_ms#2900
|
||||
QStringList valueL = valuei.split('#');
|
||||
@@ -632,12 +640,12 @@ bool Hd_CameraModule_3DKeyence::run()
|
||||
memcpy(heightImage, dwHeightBuf, xDataNum * yImageSize * 2);
|
||||
|
||||
qDebug() << __FUNCTION__ << " line:" << __LINE__ << " Height Img memcpy Finished: ";
|
||||
std::vector<unsigned short>poits(xDataNum* yImageSize * 2,0);
|
||||
if (_getParam[deviceId].luminance_enabled > 0)
|
||||
{
|
||||
unsigned short* dwLuminanceBuf = (unsigned short*)&_luminanceBuf[deviceId][0];
|
||||
memcpy(luminanceImage, dwLuminanceBuf, xDataNum * yImageSize * 2);
|
||||
}
|
||||
|
||||
// Free memory
|
||||
if (_heightBuf[deviceId] != NULL)
|
||||
{
|
||||
@@ -653,9 +661,23 @@ bool Hd_CameraModule_3DKeyence::run()
|
||||
qDebug() << __FUNCTION__ << " line:" << __LINE__ << " Free memory Finished: ";
|
||||
|
||||
m_mutex->lock();
|
||||
//vector_mat.clear();
|
||||
luminanceMatS.enqueue(cv::Mat(yImageSize, xImageSize, CV_16U, luminanceImage));
|
||||
heightMatS.enqueue(cv::Mat(yImageSize, xImageSize, CV_16U, heightImage));
|
||||
//std::vector<unsigned short> points(yImageSize* xImageSize,0);
|
||||
//memcpy(points.data(), luminanceImage, yImageSize* xImageSize);
|
||||
//std::vector<unsigned short> pointsTmp;
|
||||
//for (int i = 0; i < points.size() / 2; i++)//X处理
|
||||
// pointsTmp.push_back(points[i*2]);
|
||||
//points.clear();
|
||||
//for (int i = 0; i < yImageSize / 2; i++)//Y处理
|
||||
// for (int i2 = 0; i2 < xImageSize; i2++)//Y处理
|
||||
// points.push_back(pointsTmp[i * 2 * xImageSize + i2]);
|
||||
//for (auto& data : points)data /=4;
|
||||
//cv::Mat Lmat(yImageSize / 2, xImageSize / 2, CV_8UC1, points.data());
|
||||
cv::Mat luminanceMat(yImageSize, xImageSize, CV_16UC1, luminanceImage);
|
||||
cv::normalize(luminanceMat, luminanceMat, 0, 255, cv::NORM_MINMAX);
|
||||
cv::convertScaleAbs(luminanceMat, luminanceMat);
|
||||
luminanceMatS.enqueue(luminanceMat);
|
||||
|
||||
heightMatS.enqueue(cv::Mat(yImageSize, xImageSize, CV_16UC1, heightImage));
|
||||
m_mutex->unlock();
|
||||
qDebug() << __FUNCTION__ << " line:" << __LINE__ << " success to acquire 3d image! camera_name: " << camera_name;
|
||||
//Start HighSpeed
|
||||
|
||||
Reference in New Issue
Block a user