fixed typo in normal, added gt point 3d
This commit is contained in:
@@ -251,9 +251,9 @@ namespace Floorplan {
|
|||||||
/** a GroundTruthPoint located somewhere on a floor */
|
/** a GroundTruthPoint located somewhere on a floor */
|
||||||
struct GroundTruthPoint {
|
struct GroundTruthPoint {
|
||||||
int id; //TODO: this value can be changed and isn't set incremental within the indoormap
|
int id; //TODO: this value can be changed and isn't set incremental within the indoormap
|
||||||
Point2 pos;
|
Point3 pos;
|
||||||
GroundTruthPoint() : id(), pos() {;}
|
GroundTruthPoint() : id(), pos() {;}
|
||||||
GroundTruthPoint(const int& id, const Point2& pos) : id(id), pos(pos) {;}
|
GroundTruthPoint(const int& id, const Point3& pos) : id(id), pos(pos) {;}
|
||||||
bool operator == (const GroundTruthPoint& o) const {return (o.id == id) && (o.pos == pos);}
|
bool operator == (const GroundTruthPoint& o) const {return (o.id == id) && (o.pos == pos);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Floorplan {
|
|||||||
if (std::string("pois") == n->Name()) {floor->pois = parseFloorPOIs(n);}
|
if (std::string("pois") == n->Name()) {floor->pois = parseFloorPOIs(n);}
|
||||||
if (std::string("stairs") == n->Name()) {floor->stairs = parseFloorStairs(n);}
|
if (std::string("stairs") == n->Name()) {floor->stairs = parseFloorStairs(n);}
|
||||||
if (std::string("elevators") == n->Name()) {floor->elevators = parseFloorElevators(n);}
|
if (std::string("elevators") == n->Name()) {floor->elevators = parseFloorElevators(n);}
|
||||||
if (std::string("gtpoints") == n->Name()) {floor->gtpoints = parseFloorGroundTruthPoints(n);}
|
if (std::string("gtpoints") == n->Name()) {floor->gtpoints = parseFloorGroundTruthPoints(n);}
|
||||||
}
|
}
|
||||||
return floor;
|
return floor;
|
||||||
}
|
}
|
||||||
@@ -198,22 +198,22 @@ namespace Floorplan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** parse the <gtpoints> tag */
|
/** parse the <gtpoints> tag */
|
||||||
static std::vector<GroundTruthPoint*> parseFloorGroundTruthPoints(const XMLElem* el) {
|
static std::vector<GroundTruthPoint*> parseFloorGroundTruthPoints(const XMLElem* el) {
|
||||||
std::vector<GroundTruthPoint*> vec;
|
std::vector<GroundTruthPoint*> vec;
|
||||||
FOREACH_NODE(n, el) {
|
FOREACH_NODE(n, el) {
|
||||||
if (std::string("gtpoint") == n->Name()) { vec.push_back(parseFloorGroundTruthPoint(n)); }
|
if (std::string("gtpoint") == n->Name()) { vec.push_back(parseFloorGroundTruthPoint(n)); }
|
||||||
}
|
}
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** parse a <gtpoint> tag */
|
/** parse a <gtpoint> tag */
|
||||||
static GroundTruthPoint* parseFloorGroundTruthPoint(const XMLElem* el) {
|
static GroundTruthPoint* parseFloorGroundTruthPoint(const XMLElem* el) {
|
||||||
GroundTruthPoint* gtp = new GroundTruthPoint();
|
GroundTruthPoint* gtp = new GroundTruthPoint();
|
||||||
gtp->id = el->IntAttribute("id");
|
gtp->id = el->IntAttribute("id");
|
||||||
gtp->pos = parsePoint2(el);
|
gtp->pos = parsePoint3(el);
|
||||||
return gtp;
|
return gtp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** parse the <accesspoints> tag */
|
/** parse the <accesspoints> tag */
|
||||||
|
|||||||
@@ -146,15 +146,16 @@ namespace Floorplan {
|
|||||||
}
|
}
|
||||||
floor->InsertEndChild(pois);
|
floor->InsertEndChild(pois);
|
||||||
|
|
||||||
XMLElem* gtpoints = doc.NewElement("gtpoints");
|
XMLElem* gtpoints = doc.NewElement("gtpoints");
|
||||||
for (const GroundTruthPoint* gtp : mf->gtpoints) {
|
for (const GroundTruthPoint* gtp : mf->gtpoints) {
|
||||||
XMLElem* elem = doc.NewElement("gtpoint");
|
XMLElem* elem = doc.NewElement("gtpoint");
|
||||||
elem->SetAttribute("id", gtp->id);
|
elem->SetAttribute("id", gtp->id);
|
||||||
elem->SetAttribute("x", gtp->pos.x);
|
elem->SetAttribute("x", gtp->pos.x);
|
||||||
elem->SetAttribute("y", gtp->pos.y);
|
elem->SetAttribute("y", gtp->pos.y);
|
||||||
gtpoints->InsertEndChild(elem);
|
elem->SetAttribute("z", gtp->pos.z);
|
||||||
}
|
gtpoints->InsertEndChild(elem);
|
||||||
floor->InsertEndChild(gtpoints);
|
}
|
||||||
|
floor->InsertEndChild(gtpoints);
|
||||||
|
|
||||||
XMLElem* accesspoints = doc.NewElement("accesspoints");
|
XMLElem* accesspoints = doc.NewElement("accesspoints");
|
||||||
for (const AccessPoint* ap : mf->accesspoints) {
|
for (const AccessPoint* ap : mf->accesspoints) {
|
||||||
|
|||||||
@@ -75,6 +75,19 @@ namespace Distribution {
|
|||||||
return NormalDistributionN(mean, cov);
|
return NormalDistributionN(mean, cov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** return a NormalN based on given data and a given mean vector mu*/
|
||||||
|
static NormalDistributionN getNormalNFromSamplesAndMean(const Eigen::MatrixXd& data, const Eigen::VectorXd mean) {
|
||||||
|
|
||||||
|
const int numElements = data.rows();
|
||||||
|
Assert::notEqual(numElements, 1, "data is just 1 value, thats not enough for getting the distribution!");
|
||||||
|
Assert::notEqual(numElements, 0, "data is empty, thats not enough for getting the distribution!");
|
||||||
|
|
||||||
|
const Eigen::MatrixXd centered = data.rowwise() - mean.transpose();
|
||||||
|
const Eigen::MatrixXd cov = (centered.adjoint() * centered) / double(data.rows() - 1);
|
||||||
|
|
||||||
|
return NormalDistributionN(mean, cov);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user