I am using this method to rotate a cvMat
, whenever I run it I get back a rotated image however there is a lot of deadspace below it.
void rotate(cv::Mat& src, double angle, cv::Mat& dst)
{
int len = std::max(src.cols, src.rows);
cv::Point2f pt(len/2., len/2.);
cv::Mat r = cv::getRotationMatrix2D(pt, angle, 1.0);
cv::warpAffine(src, dst, r, cv::Size(len, len));
}
When given this image:
I get this image:
The image has been rotated but as you can see some extra pixels have been added, how can I only rotate the original image and not add any extra pixels?
Method call:
rotate(src, skew, res);
res
being dst
.