fixed typo in normal, added gt point 3d

This commit is contained in:
toni
2017-03-20 11:42:46 +01:00
parent d065015f7d
commit 485be83b44
4 changed files with 41 additions and 27 deletions

View File

@@ -251,9 +251,9 @@ namespace Floorplan {
/** a GroundTruthPoint located somewhere on a floor */
struct GroundTruthPoint {
int id; //TODO: this value can be changed and isn't set incremental within the indoormap
Point2 pos;
Point3 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);}
};

View File

@@ -211,7 +211,7 @@ namespace Floorplan {
static GroundTruthPoint* parseFloorGroundTruthPoint(const XMLElem* el) {
GroundTruthPoint* gtp = new GroundTruthPoint();
gtp->id = el->IntAttribute("id");
gtp->pos = parsePoint2(el);
gtp->pos = parsePoint3(el);
return gtp;
}

View File

@@ -152,6 +152,7 @@ namespace Floorplan {
elem->SetAttribute("id", gtp->id);
elem->SetAttribute("x", gtp->pos.x);
elem->SetAttribute("y", gtp->pos.y);
elem->SetAttribute("z", gtp->pos.z);
gtpoints->InsertEndChild(elem);
}
floor->InsertEndChild(gtpoints);

View File

@@ -75,6 +75,19 @@ namespace Distribution {
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);
}
};
}