2 #ifndef vil_rotate_hxx_ 3 #define vil_rotate_hxx_ 17 # include <vcl_msvc_warnings.h> 21 static inline double calc_theta_mod(
double theta,
double x)
24 double theta_x = std::fmod(theta,x);
31 template <
class sType,
class dType>
39 double theta_90= calc_theta_mod( theta_deg, 90.0 );
40 double theta_360= calc_theta_mod( theta_deg, 360.0 );
42 std::cout<<
"theta_90 = "<<theta_90<<std::endl
43 <<
"theta_360= "<<theta_360<<std::endl;
50 int src_ni = src_image.
ni();
51 int src_nj = src_image.
nj();
52 double c= std::cos(theta_90*3.14159265358979323846/180);
53 double s= std::sin(theta_90*3.14159265358979323846/180);
56 double ai= -src_nj*s*c;
57 double aj= src_nj*s*s;
58 double bi= src_ni*c*c;
59 double bj= -src_ni*s*c;
60 double ci= src_ni*s*s;
63 double dj= src_nj*c*c;
66 int l1= int( src_nj*s+ src_ni*c );
67 int l2= int( src_nj*c+ src_ni*s );
71 double dx1, dy1, dx2, dy2, x0, y0;
74 assert(theta_360>= 0.0 && theta_360 < 360.0);
76 if ( theta_360< 90.0 )
87 else if (theta_360< 180.0 )
98 else if (theta_360< 270.0 )
124 #define VIL_ROTATE_INSTANTIATE( sType, dType ) \ 125 template void vil_rotate_image(const vil_image_view<sType >& src_image, \ 126 vil_image_view<dType >& dest_image, \ 129 #endif // vil_rotate_hxx_ Concrete view of image data of type T held in memory.
void vil_rotate_image(const vil_image_view< sType > &src_image, vil_image_view< dType > &dest_image, double theta_deg)
Rotate image by angle theta.
Sample grid of points with bilinear interpolation in one image and place in another.
rotate an image, using the resampling functions
unsigned ni() const
Width.
unsigned nj() const
Height.
void vil_resample_bilin(const vil_image_view< sType > &src_image, vil_image_view< dType > &dest_image, double x0, double y0, double dx1, double dy1, double dx2, double dy2, int n1, int n2)
Sample grid of points in one image and place in another, using bilinear interpolation.