20 #include <QVBoxLayout>
31 if (depthBuffer.
zBuff.empty()) {
41 double sumDist2 = 0.0;
43 for (
unsigned x = 0;
x < depthBuffer.
height * depthBuffer.
width;
46 maxDist = minDist = *_zBuff;
47 }
else if (*_zBuff > 0) {
48 maxDist = std::max(maxDist, *_zBuff);
49 minDist = std::min(minDist, *_zBuff);
54 sumDist2 +=
static_cast<double>(*_zBuff) * *_zBuff;
60 double avg = sumDist /
count;
61 double stdDev = sqrt(std::abs(sumDist2 /
count - avg * avg));
68 QImage bufferImage(depthBuffer.
width, depthBuffer.
height,
69 QImage::Format_RGB32);
81 for (
unsigned y = 0;
y < depthBuffer.
height; ++
y) {
82 for (
unsigned x = 0;
x < depthBuffer.
width; ++
x, ++_zBuff) {
85 ? colorScale->getColorByIndex(
86 static_cast<unsigned>(
87 (std::min(maxDist, *_zBuff) -
91 bufferImage.setPixel(
x, depthBuffer.
height - 1 -
y,
92 qRgb(col.
r, col.
g, col.
b));
97 QDialog* dlg =
new QDialog(parent);
98 dlg->setWindowTitle(QString(
"%0 depth buffer [%1 x %2]")
100 .arg(depthBuffer.
width)
101 .arg(depthBuffer.
height));
104 std::max<unsigned>(depthBuffer.
width, depthBuffer.
height);
106 while (maxDBDim > maxDim) {
110 dlg->setFixedSize(bufferImage.size() / scale);
112 QVBoxLayout* vboxLayout =
new QVBoxLayout(dlg);
113 vboxLayout->setContentsMargins(0, 0, 0, 0);
114 QLabel* label =
new QLabel(dlg);
115 label->setScaledContents(
true);
116 vboxLayout->addWidget(label);
118 label->setPixmap(QPixmap::fromImage(bufferImage));
132 ScaleElement(
double val,
bool dispText =
true,
bool isCondensed =
false)
156 using vlabelPair = std::pair<vlabelSet::iterator, vlabelSet::iterator>;
162 vlabelSet::iterator it1 = set.begin();
166 vlabelSet::iterator it2 = it1;
168 for (; it2 != set.end(); ++it2, ++it1) {
182 ScalarType absDispMin = (dispMax < 0 ? std::min(-dispMax, -dispMin)
183 : std::max<ScalarType>(dispMin, 0));
184 ScalarType absDispMax = std::max(std::abs(dispMin), std::abs(dispMax));
185 dispMin = std::log10(
186 std::max(absDispMin, std::numeric_limits<ScalarType>::epsilon()));
187 dispMax = std::log10(
188 std::max(absDispMax, std::numeric_limits<ScalarType>::epsilon()));
float PointCoordinateType
Type of the coordinates of a (N-D) point.
QSharedPointer< ccColorScale > Shared
Shared pointer type.
static const unsigned MAX_STEPS
Maximum number of steps (internal representation)
static ccColorScale::Shared GetDefaultScale(DEFAULT_SCALES scale=BGYR)
Returns a pre-defined color scale (static shortcut)
unsigned height
Buffer height.
std::vector< PointCoordinateType > zBuff
Z-Buffer grid.
unsigned width
Buffer width.
Ground-based Laser sensor.
const ccDepthBuffer & getDepthBuffer() const
Returns the associated depth buffer.
ccHObject * getParent() const
Returns parent object.
virtual QString getName() const
Returns object name.
A scalar field associated to display-related parameters.
const ccColorScale::Shared & getColorScale() const
Returns associated color scale.
bool LessThanEpsilon(float x)
Test a floating point number against our epsilon (a very small number).
constexpr Rgb black(0, 0, 0)
Graphical scale atomical element.
double value
Starting value.
ScaleElement(double val, bool dispText=true, bool isCondensed=false)
Default constructor.
bool condensed
Specifies whether the cube is condensed or not.
bool textDisplayed
Specifies whether the value should be displayed.
vlabel(int y, int y1, int y2, double v)