【问题标题】:Crop/zoom formula after rotating an image旋转图像后的裁剪/缩放公式
【发布时间】:2021-08-23 12:50:46
【问题描述】:

如果我将 16:9 图像旋转到然后裁剪/放大以填满整个 16:9 屏幕,您对公式有什么看法吗?

例如,当我将图像倾斜 4 度时,我必须将我的编辑程序从 1.0 放大到 1.121 这里有3个例子

  • 4 = 1.121
  • 45 = 1.963
  • 90 = 1.777

对于 45 度角,该值会更高,因此该图几乎有点像图上的贝尔曲线(不完全是)。

to put it another way, just like photoshop, if you rotate an image a little, how much do you have to zoom in to fill the boundaries again so there is no white space on the edges. 

【问题讨论】:

    标签: math geometry formula


    【解决方案1】:

    如果初始矩形的高度为h,宽度为w=16/9*h,则旋转后的边界矩形具有尺寸(here with picture):

    H = 16/9 * h * Abs(Sin(Fi)) + h * Abs(Cos(Fi))
    W = 16/9 * h * Abs(Cos(Fi)) + h * Abs(Sin(Fi))
    

    现在需要垂直轴和水平轴的系数:

    cfvert = (16/9 * h * Abs(Sin(Fi)) + h * Abs(Cos(Fi))) / h = 
            16/9 * Abs(Sin(Fi)) + Abs(Cos(Fi))
    
    cfhor =  (16/9 * h * Abs(Cos(Fi)) + h * Abs(Sin(Fi))) / (16/9 * h) = 
            Abs(Cos(Fi)) + 9/16 * Abs(Sin(Fi))
    

    这些系数的结果是最大的 - 绝对是第一个:

    coeff = max(cfvert, cfhor)  = 16/9 * Abs(Sin(Fi)) + Abs(Cos(Fi))  
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-17
      • 1970-01-01
      • 2013-05-10
      • 2011-08-27
      • 2016-08-29
      • 2017-06-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多