answered 2018-11-01 15:32:08 -0600
what you want, in the end is to specify the background color explicitly, like :
rotated_image = cv2.warpAffine(img, M, (cols, rows), borderValue=(255,255,255))