I'm trying to rotate an image using
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(src.cols, src.rows)); }
indicating the angle, source and image of the destination. The rotation works correctly as follows.

I want to make black areas white. I tried with
cv::Mat dst = cv::Mat::ones(src.cols, src.rows, src.type());
before calling rotate, but without changing the result. How can I achieve this?
Note. I am looking for a solution that achieves this while doing a rotation. obviously by making black areas white after rotation, this can be achieved.
source share