我就废话不多说了,直接上代码吧!
import cv2
from math import fabs, sin, cos, radians
import numpy as np
from scipy.stats import mode
def get_img_rot_broa(img, degree=45, filled_color=-1):
"""
Desciption:
Get img rotated a certain degree,
and use some color to
最近在做深度学习时需要用到图像处理相关的操作,在度娘上找到的图片旋转方法千篇一律,旋转完成的图片都不是原始大小,很苦恼,于是google到歪果仁的网站扒拉了一个方法,亲测好用,再次嫌弃天下文章一大抄的现象,虽然我也是抄歪果仁的。
废话不多说了,直接贴代码了。
def rotate_bound(image, angle):
# grab the dimensions of the image and then determine the
# center
(h, w) = image