25 #include <Base/Common/BIASpragmaStart.hh>
27 #ifndef __TextureMapping_hh__
28 #define __TextureMapping_hh__
30 #include <Image/BackwardMapping.hh>
31 #include <Image/TextureTransform.hh>
42 template <
class InputStorageType,
class OutputStorageType>
63 if (T_!=NULL)
delete T_;
69 unsigned int srcheight,
70 unsigned int sinkwidth,
71 unsigned int sinkheight,
76 brx=sinkwidth; bry=sinkheight;
80 if (tlx>sink[0]) tlx = int(rint(sink[0]-1.0));
81 if (tly>sink[1]) tly = int(rint(sink[1]-1.0));
82 if (brx<sink[0]) brx = int(rint(sink[0]+1.0));
83 if (bry<sink[1]) bry = int(rint(sink[1]+1.0));
85 if (tlx>sink[0]) tlx = int(rint(sink[0]-1.0));
86 if (tly>sink[1]) tly = int(rint(sink[1]-1.0));
87 if (brx<sink[0]) brx = int(rint(sink[0]+1.0));
88 if (bry<sink[1]) bry = int(rint(sink[1]+1.0));
90 if (tlx>sink[0]) tlx = int(rint(sink[0]-1.0));
91 if (tly>sink[1]) tly = int(rint(sink[1]-1.0));
92 if (brx<sink[0]) brx = int(rint(sink[0]+1.0));
93 if (bry<sink[1]) bry = int(rint(sink[1]+1.0));
94 T_->MapForward(
HomgPoint2D(srcwidth-1, srcheight-1), sink);
95 if (tlx>sink[0]) tlx = int(rint(sink[0]-1.0));
96 if (tly>sink[1]) tly = int(rint(sink[1]-1.0));
97 if (brx<sink[0]) brx = int(rint(sink[0]+1.0));
98 if (bry<sink[1]) bry = int(rint(sink[1]+1.0));
111 virtual int GetSourceCoordinates_(
const HomgPoint2D& sink,
123 #include <Base/Common/BIASpragmaEnd.hh>
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Abstract base class to map an image (texture) src to an image sink with an arbitrary continuous funct...
TextureTransform * T_
Textures for backward mapping: Run over sink and compute source.
class for representing parameterized image warps, such as homography, displacement, ...
virtual TextureTransform * Clone() const =0
virtual covariant copy constructor, caller must eventually destroy the created object ...
void SetTextureTransform(const TextureTransform &T)
create clone of your texture tranform and set for mapping
Maps source pixel to sink pixel given any TextureTransform.
virtual int GetBoundingBox(unsigned int srcwidth, unsigned int srcheight, unsigned int sinkwidth, unsigned int sinkheight, int &tlx, int &tly, int &brx, int &bry)
calculates the bounding box in sink image, where to do the backward mapping.
class BIASGeometryBase_EXPORT HomgPoint2D