Browse Source

Scan conversion show3D is modified.

Arash Aletayeb 7 months ago
parent
commit
4a1ac945f6
  1. 2
      developHw.pro.user
  2. 21
      hdf5Scenario/hdf5Scenario.cpp
  3. 2
      hdf5Scenario/hdf5Scenario.h
  4. 147
      mainwindow.cpp
  5. 12
      mainwindow.ui

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2024-04-23T15:35:59. -->
<!-- Written by QtCreator 4.10.0, 2024-04-24T18:13:33. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

21
hdf5Scenario/hdf5Scenario.cpp

@ -1076,11 +1076,16 @@ void Hdf5::scanConversionParamsRead(scanConversionParameters &params)
params.dz = (floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/rxLineNo ***/
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/rxLineNo", floatArray);
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/rxLineNo", floatArray); //input
//frame
//width
params.gridX_size = static_cast<quint32>(floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/rxFocusPointNo ***/
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/rxFocusPointNo", floatArray);
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/rxFocusPointNo",
floatArray); //input
//frame
//depth
params.gridZ_size = static_cast<quint32>(floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/scanAz ***/
@ -1104,12 +1109,20 @@ void Hdf5::scanConversionParamsRead(scanConversionParameters &params)
params.gridZ = gridZ;
/*** /swScenarioParameters/scanConversionParameters/pixelParameters/pixelZNo ***/
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/pixelParameters/pixelZNo", floatArray);
datasetBranch<float_t>(
"/swScenarioParameters/scanConversionParameters/pixelParameters/pixelZNo", //output
//image
//depth
floatArray);
quint32 queryRow = static_cast<quint32>(floatArray[0]);
params.pixelZNo = queryRow;
/*** /swScenarioParameters/scanConversionParameters/pixelParameters/pixelXNo ***/
datasetBranch<float_t>("/swScenarioParameters/scanConversionParameters/pixelParameters/pixelXNo", floatArray);
datasetBranch<float_t>(
"/swScenarioParameters/scanConversionParameters/pixelParameters/pixelXNo", //output
//image
//width
floatArray);
quint32 queryColumn = static_cast<quint32>(floatArray[0]);
params.pixelXNo = queryColumn;

2
hdf5Scenario/hdf5Scenario.h

@ -7,7 +7,7 @@
#include "model/hardware/core/lowLevelApi/TrxBoard.h"
#include "../kernelParams/KernelParams.h"
#define MAX_ARRAY_DEPTH 131072U
#define MAX_ARRAY_DEPTH 1310720U
using namespace std;
using namespace H5;

147
mainwindow.cpp

@ -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))

12
mainwindow.ui

@ -1752,7 +1752,7 @@ Scenarios</string>
<widget class="QLabel" name="label_97">
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
@ -1794,7 +1794,7 @@ Scenarios</string>
<widget class="QLabel" name="label_101">
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
@ -1840,7 +1840,7 @@ Scenarios</string>
<widget class="QLabel" name="label_105">
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
@ -1872,7 +1872,9 @@ Scenarios</string>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
@ -1912,7 +1914,7 @@ Scenarios</string>
<widget class="QLabel" name="label_104">
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>

Loading…
Cancel
Save