I would like to rotate an image in OpenCV (I'm currently doing it this way image manipulation SO answer ) but would like to specify the colour used to fill the gaps created by the rotation - by default, it's black (see below)
How could this be done?
I think the answer lies in the official doc :
C: void cvWarpAffine(const CvArr* src, CvArr* dst, const CvMat* map_matrix, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, CvScalar fillval=cvScalarAll(0) )
where
CvScalar fillval=cvScalarAll(0)
specifies the fill color of the "gap".
Just specify the fillval
with a color scalar when calling this function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.