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. 101
      mainwindow.cpp
  5. 12
      mainwindow.ui

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

21
hdf5Scenario/hdf5Scenario.cpp

@ -1076,11 +1076,16 @@ void Hdf5::scanConversionParamsRead(scanConversionParameters &params)
params.dz = (floatArray[0]); params.dz = (floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/rxLineNo ***/ /*** /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]); params.gridX_size = static_cast<quint32>(floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/rxFocusPointNo ***/ /*** /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]); params.gridZ_size = static_cast<quint32>(floatArray[0]);
/*** /swScenarioParameters/scanConversionParameters/scanAz ***/ /*** /swScenarioParameters/scanConversionParameters/scanAz ***/
@ -1104,12 +1109,20 @@ void Hdf5::scanConversionParamsRead(scanConversionParameters &params)
params.gridZ = gridZ; params.gridZ = gridZ;
/*** /swScenarioParameters/scanConversionParameters/pixelParameters/pixelZNo ***/ /*** /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]); quint32 queryRow = static_cast<quint32>(floatArray[0]);
params.pixelZNo = queryRow; params.pixelZNo = queryRow;
/*** /swScenarioParameters/scanConversionParameters/pixelParameters/pixelXNo ***/ /*** /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]); quint32 queryColumn = static_cast<quint32>(floatArray[0]);
params.pixelXNo = queryColumn; params.pixelXNo = queryColumn;

2
hdf5Scenario/hdf5Scenario.h

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

101
mainwindow.cpp

@ -2245,47 +2245,43 @@ void MainWindow::show3d()
qDebug() << "mPoint" << mPoint; qDebug() << "mPoint" << mPoint;
_colorMap->data()->clear(); _colorMap->data()->clear();
_colorMap->data()->setSize(line, point + 1);
_colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point + 1));
quint32 max = 0; if(_isScanConvDynamicCont)
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 + 1); pnt += 1)
{ {
indx = (ln * point + pnt) * 4 + 160; _colorMap->data()->setSize(static_cast<qint32>(scanConversionParams.pixelXNo),
auto val = frameDataCalc(plotPacket, indx); static_cast<qint32>(scanConversionParams.pixelZNo + 1));
_colorMap->data()->setRange(QCPRange(1,
if(max < val) static_cast<qint32>(scanConversionParams.pixelXNo)),
QCPRange(1,
static_cast<qint32>(scanConversionParams.pixelZNo +
1)));
for(quint32 ln = 0; ln < scanConversionParams.pixelXNo; ln += 1)
{ {
max = val; for(quint32 pnt = 0; pnt < scanConversionParams.pixelZNo + 1; pnt += 1)
}
if(_isScanConvDynamicCont)
{ {
float pixel = 0.0f; float pixel = 0.0f;
float queryX = 0.0f; float queryX = 0.0f;
float queryZ = 0.0f; float queryZ = 0.0f;
quint32 scanValue = 0;
if(static_cast<quint32>(pnt) < scanConversionParams.pixelZNo && if(pnt < scanConversionParams.pixelZNo && ln < scanConversionParams.pixelXNo)
static_cast<quint32>(ln) < scanConversionParams.pixelXNo)
{ {
queryX = scanConversionParams.queryX.at(ln).at(pnt); queryX = scanConversionParams.queryX.at(static_cast<qint32>(ln)).at(
queryZ = scanConversionParams.queryZ.at(ln).at(pnt); static_cast<qint32>(pnt));
queryZ = scanConversionParams.queryZ.at(static_cast<qint32>(ln)).at(
static_cast<qint32>(pnt));
} }
QPair<qint32, qint32> index = readScanConversionIndex(queryX, queryZ, scanConversionParams); QPair<qint32, qint32> index = readScanConversionIndex(queryX,
queryZ,
scanConversionParams);
qint32 gridX_index = index.first; qint32 gridX_index = index.first;
qint32 gridZ_index = index.second; qint32 gridZ_index = index.second;
if(gridX_index >= 0 && (gridX_index) < static_cast<qint32>(scanConversionParams.gridX_size - 1) && if(gridX_index >= 0 &&
gridZ_index >= 0 && (gridZ_index) < static_cast<qint32>(scanConversionParams.gridZ_size - 1)) (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.a11 = scanConversionParams.gridZ.at(gridZ_index + 1) - queryZ;
matrix.a12 = queryZ - scanConversionParams.gridZ.at(gridZ_index); matrix.a12 = queryZ - scanConversionParams.gridZ.at(gridZ_index);
@ -2295,19 +2291,20 @@ void MainWindow::show3d()
matrix.dz = scanConversionParams.dz; matrix.dz = scanConversionParams.dz;
auto scanConIndex = (gridX_index * point + gridZ_index) * 4 + 160; auto scanConIndex = (gridX_index * point + gridZ_index) * 4 + 160;
auto scanConValue = frameDataCalc(plotPacket, scanConIndex); auto scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex);
matrix.b11 = scanConValue; matrix.b11 = scanConValue;
scanConIndex = ((gridX_index + 1) * point + gridZ_index) * 4 + 160; scanConIndex = ((gridX_index + 1) * point + gridZ_index) * 4 + 160;
scanConValue = frameDataCalc(plotPacket, scanConIndex); scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex);
matrix.b12 = scanConValue; matrix.b12 = scanConValue;
scanConIndex = (gridX_index * point + (gridZ_index + 1)) * 4 + 160; scanConIndex = (gridX_index * point + (gridZ_index + 1)) * 4 + 160;
scanConValue = frameDataCalc(plotPacket, scanConIndex); scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex);
matrix.b21 = scanConValue; matrix.b21 = scanConValue;
scanConIndex = ((gridX_index + 1) * point + (gridZ_index + 1)) * 4 + 160; scanConIndex = ((gridX_index + 1) * point + (gridZ_index + 1)) * 4 +
scanConValue = frameDataCalc(plotPacket, scanConIndex); 160;
scanConValue = frameDataCalc(plotFrame.at(0), scanConIndex);
matrix.b22 = scanConValue; matrix.b22 = scanConValue;
pixel = scanConversionFmaCalc(matrix); pixel = scanConversionFmaCalc(matrix);
@ -2315,21 +2312,49 @@ void MainWindow::show3d()
pixel = DynamicContrast(pixel, dynamicContrastParams); pixel = DynamicContrast(pixel, dynamicContrastParams);
} }
val = static_cast<quint32>(pixel); scanValue = static_cast<quint32>(pixel);
}
if(pnt == point) if(pnt == scanConversionParams.pixelZNo)
{ {
_colorMap->data()->setCell(lnSum + ln, pnt, double(255)); scanValue = 255;
}
_colorMap->data()->setCell(static_cast<qint32>(ln),
static_cast<qint32>(scanConversionParams.pixelZNo -
pnt),
static_cast<double>(scanValue));
}
}
} }
else else
{ {
_colorMap->data()->setCell(lnSum + ln, pnt, double(val)); _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)) if(!ui->plot_2->plotLayout()->hasElement(0, 1))
{ {

12
mainwindow.ui

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

Loading…
Cancel
Save