I use the following code to rotate images in opencv. However, after that the corners are painted black. I thought when I set borderMode to BORDER_CONSTANT , I can specify the color. But no matter what color I choose (the last parameter), the result is always black.
cv::Mat rotated; float rotation = 3.0f; cv::warpAffine(img, rotated, rotation, img.size(), cv::INTER_CUBIC, cv::BORDER_CONSTANT, cv::Scalar(1.0, 1.0, 1.0, 0.0)); cv::imshow("rotated", rotated);
Could someone explain to me what I'm doing wrong here?
I know that after that I could use cv::floodFill , but somehow this can be done using only warpAffine .
Pedro source share