Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GenVisiblePoints.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __GenVisiblePoints_hh__
27 #define __GenVisiblePoints_hh__
28 
29 #include <bias_config.h>
30 #include <Base/Common/BIASpragmaStart.hh>
31 
32 #include <vector>
33 #include <Base/Math/Random.hh>
34 #include <Geometry/ProjectionParametersBase.hh>
35 
36 namespace BIAS {
37 
38  /** @class GenVisiblePoints
39  @ingroup g_utils
40  @brief Class for generating 3D points visible by a set of cameras.
41  @author jkollmann */
42  class BIASUtils_EXPORT GenVisiblePoints
43  {
44  public:
45 
46  /** Generates 3D points visible by the given cameras.
47  - pp:
48  Projection parameters defining the cameras.
49  - numVisiblePointsPerCamera:
50  Minimum number of points visible by each camera.
51  - numTries:
52  Number of tries to find a random point visible by a camera
53  but invisible by all previous cameras. Choosing a high number
54  will increase the probability that exactly
55  'numVisiblePointsPerCamera' points are visible by each camera.
56  - minDistance, maxDistance:
57  Minimum and maximum distance of generated points to the camera
58  center.
59  - points:
60  List of generated 3D points. */
61  void GeneratePoints(const std::vector<ProjectionParametersBase*>& pp,
62  const int numVisiblePointsPerCamera,
63  const int numTries,
64  const double minDistance,
65  const double maxDistance,
66  std::vector<HomgPoint3D>& points);
67 
68  private:
69 
70  /** Computes a single random point visible by a camera. */
71  void GenerateVisiblePoint(const ProjectionParametersBase& projection,
72  const double minDistance,
73  const double maxDistance,
74  HomgPoint3D& point);
75 
76  /** Returns true iff the given point is visible by the given camera. */
77  bool IsPointVisible(const ProjectionParametersBase& pp,
78  const HomgPoint3D& point);
79 
80  Random _rand;
81  };
82 
83 } // namespace
84 
85 #include <Base/Common/BIASpragmaEnd.hh>
86 
87 #endif // __GenVisiblePoints_hh__
Class for generating 3D points visible by a set of cameras.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
class for producing random numbers from different distributions
Definition: Random.hh:51