current state

This commit is contained in:
2017-04-24 16:12:15 +02:00
parent 67a9f02d6d
commit 755f5662ae
15 changed files with 1211 additions and 329 deletions

View File

@@ -39,7 +39,7 @@ private:
struct Entry {
Point3 pos;
K::GnuplotObjectPolygon* poly;
float max = 0;
float max = -1;
float sum = 0;
int cnt = 0;
};
@@ -51,19 +51,28 @@ private:
public:
/** ctor */
PlotWiFiGroundProb(const Floorplan::IndoorMap* map) : map(map), plot(map) {
buildEvalPoints();
PlotWiFiGroundProb(const Floorplan::IndoorMap* map, Plotty::Settings settings = Plotty::Settings()) : map(map), plot(map) {
plot.settings.outline = false;
plot.settings = settings;
buildEvalPoints();
plot.buildFloorplan();
}
Plotty& getPlot() {
return plot;
}
/** plot the ground-probability for the given measurement */
void show(const WiFiObserverFree& prob, const WiFiMeasurements& _mes) {
VAPGrouper vap(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE);
const WiFiMeasurements mes = vap.group(_mes);
// determine min/max probability
double min = +99999;
double max = -99999;
for (Entry& e : pos) {
@@ -71,9 +80,9 @@ public:
if (p < min) {min = p;}
if (p > max) {max = p;}
}
double diff = max-min;
const double diff = max-min;
// render
for (Entry& e : pos) {
const double p = prob.getProbability(e.pos, mes.entries.front().getTimestamp(), mes);
const double f = (p-min) / diff * 255;
@@ -85,11 +94,51 @@ public:
e.poly->getFill().setColor(c);
e.max = f;
//}
if (f < 0.1) {
e.poly->setEnabled(false);
}
//plot.cpoints.add(K::GnuplotPoint3(pt.x, pt.y, pt.z), p);
}
}
void showStrongest(const WiFiObserverFree& prob, const WiFiMeasurements& mes, const float hue) {
// determine min/max probability
double min = +99999;
double max = -99999;
for (Entry& e : pos) {
const double p = prob.getProbability(e.pos, mes.entries.front().getTimestamp(), mes);
if (p < min) {min = p;}
if (p > max) {max = p;}
}
const double diff = max-min;
// render
for (Entry& e : pos) {
// get probability within [0:255]
const double p = prob.getProbability(e.pos, mes.entries.front().getTimestamp(), mes);
const double f = (p-min) / diff * 255;
if (p != p) {
throw Exception("nan");
}
// overwrite weak entries
if (f > e.max) {
const K::GnuplotColor c = K::GnuplotColor::fromHSV(hue, f, 245);
e.poly->getFill().setColor(c);
e.max = f;
// disable unlikely onces to save performance and disk-space
e.poly->setEnabled(f > 32);
}
}
}
@@ -143,6 +192,7 @@ private:
e.poly->close();
e.poly->getFill().setStyle(K::GnuplotFillStyle::SOLID);
e.poly->setStroke(K::GnuplotStroke::NONE());
e.poly->setZIndex(f->atHeight - 0.001); // between outline and obstacles
e.pos = Point3(x, y, f->atHeight);