


% -*- texinfo -*-
% @deftypefn {Function File} {} imrotate(@var{imgPre}, @var{theta}, @var{method}, @var{bbox}, @var{extrapval})
% Rotation of a 2D matrix about its center.
%
% Input parameters:
%
% @var{imgPre} a gray-level image matrix
%
% @var{theta} the rotation angle in degrees counterclockwise
%
% @var{method}
% @itemize @w
% @item 'nearest' neighbor: fast, but produces aliasing effects.
% @item 'bilinear' interpolation: does anti-aliasing, but is slightly slower (default).
% @item 'bicubic' interpolation: does anti-aliasing, preserves edges better than bilinear interpolation, but gray levels may slightly overshoot at sharp edges. This is probably the best method for most purposes, but also the slowest.
% @item 'Fourier' uses Fourier interpolation, decomposing the rotation matrix into 3 shears. This method often results in different artifacts than homography-based methods. Instead of slightly blurry edges, this method can result in ringing artifacts (little waves near high-contrast edges). However, Fourier interpolation is better at maintaining the image information, so that unrotating will result in an image closer to the original than the other methods.
% @end itemize
%
% @var{bbox}
% @itemize @w
% @item 'loose' grows the image to accommodate the rotated image (default).
% @item 'crop' rotates the image about its center, clipping any part of the image that is moved outside its boundaries.
% @end itemize
%
% @var{extrapval} sets the value used for extrapolation. The default value
% is @code{NA} for images represented using doubles, and 0 otherwise.
% This argument is ignored of Fourier interpolation is used.
%
% Output parameters:
%
% @var{imgPost} the rotated image matrix
%
% @var{H} the homography mapping original to rotated pixel
% coordinates. To map a coordinate vector c = [x;y] to its
% rotated location, compute round((@var{H} * [c; 1])(1:2)).
%
% @var{valid} a binary matrix describing which pixels are valid,
% and which pixels are extrapolated. This output is
% not available if Fourier interpolation is used.
% @end deftypefn