|
|
@ -2245,90 +2245,115 @@ void MainWindow::show3d() |
|
|
|
qDebug() << "mPoint" << mPoint; |
|
|
|
|
|
|
|
_colorMap->data()->clear(); |
|
|
|
_colorMap->data()->setSize(line, point + 1); |
|
|
|
_colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point + 1)); |
|
|
|
|
|
|
|
quint32 max = 0; |
|
|
|
auto indx = 0; |
|
|
|
auto lnSum = 0; |
|
|
|
foreach(const QByteArray& plotPacket, plotFrame) |
|
|
|
if(_isScanConvDynamicCont) |
|
|
|
{ |
|
|
|
auto lnPacket = (((static_cast<quint16>(plotPacket[136])) & 0x00FF) | |
|
|
|
(((static_cast<quint16>(plotPacket[137])) << 8) & 0xFF00)); |
|
|
|
|
|
|
|
for(auto ln = 0; ln < lnPacket; ln += 1) |
|
|
|
_colorMap->data()->setSize(static_cast<qint32>(scanConversionParams.pixelXNo), |
|
|
|
static_cast<qint32>(scanConversionParams.pixelZNo + 1)); |
|
|
|
_colorMap->data()->setRange(QCPRange(1, |
|
|
|
static_cast<qint32>(scanConversionParams.pixelXNo)), |
|
|
|
QCPRange(1, |
|
|
|
static_cast<qint32>(scanConversionParams.pixelZNo + |
|
|
|
1))); |
|
|
|
for(quint32 ln = 0; ln < scanConversionParams.pixelXNo; ln += 1) |
|
|
|
{ |
|
|
|
for(auto pnt = 0; pnt < (point + 1); pnt += 1) |
|
|
|
for(quint32 pnt = 0; pnt < scanConversionParams.pixelZNo + 1; pnt += 1) |
|
|
|
{ |
|
|
|
indx = (ln * point + pnt) * 4 + 160; |
|
|
|
auto val = frameDataCalc(plotPacket, indx); |
|
|
|
float pixel = 0.0f; |
|
|
|
float queryX = 0.0f; |
|
|
|
float queryZ = 0.0f; |
|
|
|
quint32 scanValue = 0; |
|
|
|
|
|
|
|
if(max < val) |
|
|
|
if(pnt < scanConversionParams.pixelZNo && ln < scanConversionParams.pixelXNo) |
|
|
|
{ |
|
|
|
max = val; |
|
|
|
queryX = scanConversionParams.queryX.at(static_cast<qint32>(ln)).at( |
|
|
|
static_cast<qint32>(pnt)); |
|
|
|
queryZ = scanConversionParams.queryZ.at(static_cast<qint32>(ln)).at( |
|
|
|
static_cast<qint32>(pnt)); |
|
|
|
} |
|
|
|
|
|
|
|
if(_isScanConvDynamicCont) |
|
|
|
QPair<qint32, qint32> index = readScanConversionIndex(queryX, |
|
|
|
queryZ, |
|
|
|
scanConversionParams); |
|
|
|
qint32 gridX_index = index.first; |
|
|
|
qint32 gridZ_index = index.second; |
|
|
|
|
|
|
|
if(gridX_index >= 0 && |
|
|
|
(gridX_index) < |
|
|
|
static_cast<qint32>(scanConversionParams.gridX_size - 1) && |
|
|
|
gridZ_index >= 0 && |
|
|
|
(gridZ_index) < static_cast<qint32>(scanConversionParams.gridZ_size - 1)) |
|
|
|
{ |
|
|
|
float pixel = 0.0f; |
|
|
|
float queryX = 0.0f; |
|
|
|
float queryZ = 0.0f; |
|
|
|
|
|
|
|
if(static_cast<quint32>(pnt) < scanConversionParams.pixelZNo && |
|
|
|
static_cast<quint32>(ln) < scanConversionParams.pixelXNo) |
|
|
|
{ |
|
|
|
queryX = scanConversionParams.queryX.at(ln).at(pnt); |
|
|
|
queryZ = scanConversionParams.queryZ.at(ln).at(pnt); |
|
|
|
} |
|
|
|
QPair<qint32, qint32> index = readScanConversionIndex(queryX, queryZ, scanConversionParams); |
|
|
|
qint32 gridX_index = index.first; |
|
|
|
qint32 gridZ_index = index.second; |
|
|
|
matrix.a11 = scanConversionParams.gridZ.at(gridZ_index + 1) - queryZ; |
|
|
|
matrix.a12 = queryZ - scanConversionParams.gridZ.at(gridZ_index); |
|
|
|
matrix.c11 = scanConversionParams.gridX.at(gridX_index + 1) - queryX; |
|
|
|
matrix.c12 = queryX - scanConversionParams.gridX.at(gridX_index); |
|
|
|
matrix.dx = scanConversionParams.dx; |
|
|
|
matrix.dz = scanConversionParams.dz; |
|
|
|
|
|
|
|
if(gridX_index >= 0 && (gridX_index) < static_cast<qint32>(scanConversionParams.gridX_size - 1) && |
|
|
|
gridZ_index >= 0 && (gridZ_index) < static_cast<qint32>(scanConversionParams.gridZ_size - 1)) |
|
|
|
{ |
|
|
|
matrix.a11 = scanConversionParams.gridZ.at(gridZ_index + 1) - queryZ; |
|
|
|
matrix.a12 = queryZ - scanConversionParams.gridZ.at(gridZ_index); |
|
|
|
matrix.c11 = scanConversionParams.gridX.at(gridX_index + 1) - queryX; |
|
|
|
matrix.c12 = queryX - scanConversionParams.gridX.at(gridX_index); |
|
|
|
matrix.dx = scanConversionParams.dx; |
|
|
|
matrix.dz = scanConversionParams.dz; |
|
|
|
|
|
|
|
auto scanConIndex = (gridX_index * point + gridZ_index) * 4 + 160; |
|
|
|
auto scanConValue = frameDataCalc(plotPacket, scanConIndex); |
|
|
|
matrix.b11 = scanConValue; |
|
|
|
|
|
|
|
scanConIndex = ((gridX_index + 1) * point + gridZ_index) * 4 + 160; |
|
|
|
scanConValue = frameDataCalc(plotPacket, scanConIndex); |
|
|
|
matrix.b12 = scanConValue; |
|
|
|
auto scanConIndex = (gridX_index * point + gridZ_index) * 4 + 160; |
|
|
|
auto scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex); |
|
|
|
matrix.b11 = scanConValue; |
|
|
|
|
|
|
|
scanConIndex = (gridX_index * point + (gridZ_index + 1)) * 4 + 160; |
|
|
|
scanConValue = frameDataCalc(plotPacket, scanConIndex); |
|
|
|
matrix.b21 = scanConValue; |
|
|
|
scanConIndex = ((gridX_index + 1) * point + gridZ_index) * 4 + 160; |
|
|
|
scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex); |
|
|
|
matrix.b12 = scanConValue; |
|
|
|
|
|
|
|
scanConIndex = ((gridX_index + 1) * point + (gridZ_index + 1)) * 4 + 160; |
|
|
|
scanConValue = frameDataCalc(plotPacket, scanConIndex); |
|
|
|
matrix.b22 = scanConValue; |
|
|
|
scanConIndex = (gridX_index * point + (gridZ_index + 1)) * 4 + 160; |
|
|
|
scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex); |
|
|
|
matrix.b21 = scanConValue; |
|
|
|
|
|
|
|
pixel = scanConversionFmaCalc(matrix); |
|
|
|
scanConIndex = ((gridX_index + 1) * point + (gridZ_index + 1)) * 4 + |
|
|
|
160; |
|
|
|
scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex); |
|
|
|
matrix.b22 = scanConValue; |
|
|
|
|
|
|
|
pixel = DynamicContrast(pixel, dynamicContrastParams); |
|
|
|
} |
|
|
|
pixel = scanConversionFmaCalc(matrix); |
|
|
|
|
|
|
|
val = static_cast<quint32>(pixel); |
|
|
|
pixel = DynamicContrast(pixel, dynamicContrastParams); |
|
|
|
} |
|
|
|
|
|
|
|
if(pnt == point) |
|
|
|
scanValue = static_cast<quint32>(pixel); |
|
|
|
|
|
|
|
if(pnt == scanConversionParams.pixelZNo) |
|
|
|
{ |
|
|
|
_colorMap->data()->setCell(lnSum + ln, pnt, double(255)); |
|
|
|
scanValue = 255; |
|
|
|
} |
|
|
|
else |
|
|
|
_colorMap->data()->setCell(static_cast<qint32>(ln), |
|
|
|
static_cast<qint32>(scanConversionParams.pixelZNo - |
|
|
|
pnt), |
|
|
|
static_cast<double>(scanValue)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_colorMap->data()->setSize(line, point); |
|
|
|
_colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point)); |
|
|
|
quint32 max = 0; |
|
|
|
auto indx = 0; |
|
|
|
auto lnSum = 0; |
|
|
|
foreach(const QByteArray& plotPacket, plotFrame) |
|
|
|
{ |
|
|
|
auto lnPacket = (((static_cast<quint16>(plotPacket[136])) & 0x00FF) | |
|
|
|
(((static_cast<quint16>(plotPacket[137])) << 8) & 0xFF00)); |
|
|
|
|
|
|
|
for(auto ln = 0; ln < lnPacket; ln += 1) |
|
|
|
{ |
|
|
|
for(auto pnt = 0; pnt < point; pnt += 1) |
|
|
|
{ |
|
|
|
indx = (ln * point + pnt) * 4 + 160; |
|
|
|
auto val = frameDataCalc(plotPacket, indx); |
|
|
|
|
|
|
|
if(max < val) |
|
|
|
{ |
|
|
|
max = val; |
|
|
|
} |
|
|
|
|
|
|
|
_colorMap->data()->setCell(lnSum + ln, pnt, double(val)); |
|
|
|
} |
|
|
|
} |
|
|
|
lnSum = lnSum + lnPacket; |
|
|
|
} |
|
|
|
lnSum = lnSum + lnPacket; |
|
|
|
} |
|
|
|
|
|
|
|
if(!ui->plot_2->plotLayout()->hasElement(0, 1)) |
|
|
|