Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ForwardMappingNearestNeighbour.hh
1 #ifndef _FORWARDMAPPINGNEARESTNEIGHBOUR_HH_
2 #define _FORWARDMAPPINGNEARESTNEIGHBOUR_HH_
3 
4 #include <Base/Common/BIASpragmaStart.hh>
5 #include <Base/Image/Image.hh>
6 #include <Geometry/Projection.hh>
7 
8 namespace BIAS {
9 
10  template <class InputStorageType, class OutputStorageType>
11  class BIASImage_EXPORT ForwardMappingNearestNeighbour {
12 
13  public:
16 
18 
21 
22  void SetSourceCam(const Projection& P) {
23  SourceP_ = P;
24  SourceP_.GetParameters()->GetImageSize(dSourceWidth_,
25  dSourceHeight_);
26  }
27 
28  void SetSinkCam(const Projection& P,
29  const unsigned int dTexChannels = 1) {
30  dTexChannels_ = dTexChannels;
31  SinkP_ = P;
32  SinkP_.GetParameters()->GetImageSize(dTargetWidth_,
33  dTargetHeight_);
34  if (intermediate_.IsEmpty())
35  intermediate_.Init(dTargetWidth_,
36  dTargetHeight_);
37  if (intermediateTex_.IsEmpty())
38  intermediateTex_.Init(dTargetWidth_, dTargetHeight_,
39  dTexChannels_);
40  }
41 
42  int Map(const BIAS::Image<InputStorageType> *in,
44  const BIAS::Image<InputStorageType> *texin,
46 
48  UL = boundMin_;
49  LR = boundMax_;
50  };
51 
52  void SetFillAreaWindowSize(unsigned int size){
53  fillAreaWindowSize_ = size;
54  }
55 
56  protected:
57  BIAS::HomgPoint2D boundMin_, boundMax_,boundMinWrap_, boundMaxWrap_;
58  unsigned int fillAreaWindowSize_;
62  int ulx_, uly_, lrx_, lry_;
63  unsigned int dTexChannels_;
64  unsigned int dSourceWidth_, dSourceHeight_;
65  unsigned int dTargetWidth_, dTargetHeight_;
66  bool fillblack_;
67 
68  private:
69  unsigned int GetSummedValue_(const OutputStorageType* pixel);
70  void SetValue_(const OutputStorageType* in, OutputStorageType* out);
71  };
72 
73 
74 } // namespace
75 
76 #include <Base/Common/BIASpragmaEnd.hh>
77 
78 
79 #endif /*_FORWARDMAPPINGNEARESTNEIGHBOUR_HH_*/
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
const ProjectionParametersBase * GetParameters(unsigned int cam=0) const
const parameter access function
Definition: Projection.hh:194
This class hides the underlying projection model, like projection matrix, spherical camera...
Definition: Projection.hh:70
virtual int GetImageSize(unsigned int &Width, unsigned int &Height) const
Obtain image dimensions.
BIAS::Image< OutputStorageType > intermediateTex_
void SetSinkCam(const Projection &P, const unsigned int dTexChannels=1)
void GetROI(BIAS::HomgPoint2D &UL, BIAS::HomgPoint2D &LR)
BIAS::Image< OutputStorageType > intermediate_