25 #include "GenVisiblePoints.hh"
26 #include <Utils/ThreeDOut.hh>
27 #include <Geometry/ProjectionParametersPerspective.hh>
28 #include <Geometry/ProjectionParametersFactory.hh>
35 const int numVisiblePointsPerCamera,
37 const double minDistance,
38 const double maxDistance,
39 vector<HomgPoint3D>& points)
44 for (
unsigned int i = 0; i < pp.size(); i++)
47 int numVisiblePoints = 0;
48 for (
unsigned int j = 0; j < points.size(); j++)
50 if (IsPointVisible(*pp[i], points[j]))
56 for (
int j = 0; j < numTries; j++)
59 if (numVisiblePoints >= numVisiblePointsPerCamera)
63 GenerateVisiblePoint(*pp[i], minDistance, maxDistance, point);
66 bool visibleByOtherCamera =
false;
67 for (
unsigned int k = 0; k < i; k++)
69 if (IsPointVisible(*pp[k], point))
71 visibleByOtherCamera =
true;
77 if (!visibleByOtherCamera)
79 points.push_back(point);
87 while (numVisiblePoints < numVisiblePointsPerCamera)
90 GenerateVisiblePoint(*pp[i], minDistance, maxDistance, point);
92 points.push_back(point);
99 void GenVisiblePoints::
101 double minDistance,
double maxDistance,
104 unsigned int width, height;
107 double x = _rand.GetUniformDistributed(0, width - 1);
108 double y = _rand.GetUniformDistributed(0, height - 1);
109 double d = _rand.GetUniformDistributed(minDistance, maxDistance);
117 bool GenVisiblePoints::
virtual BIAS::Vector3< double > GetC() const
Get projection center.
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
void Homogenize()
homogenize class data member elements to W==1 by divison by W
virtual bool DoesPointProjectIntoImage(const HomgPoint3D &X, HomgPoint2D &x, bool IgnoreDistortion=false) const
Checks if 3D point projects into specified image and returns belonging 2D image point.
virtual void UnProjectToRay(const HomgPoint2D &pos, Vector3< double > &origin, Vector3< double > &direction, bool ignoreDistortion=false) const
Calculates the view ray, which belongs to the given position on the image plane, in global coordinate...
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
virtual int GetImageSize(unsigned int &Width, unsigned int &Height) const
Obtain image dimensions.
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
Vector3< T > & Normalize()
normalize this vector to length 1
void GeneratePoints(const std::vector< ProjectionParametersBase * > &pp, const int numVisiblePointsPerCamera, const int numTries, const double minDistance, const double maxDistance, std::vector< HomgPoint3D > &points)
Generates 3D points visible by the given cameras.
class BIASGeometryBase_EXPORT HomgPoint2D
class BIASGeometryBase_EXPORT HomgPoint3D