问题描述
我希望图像中的眼睛是水平的
$rightEyeY = 446;
$rightEyeX = 625;
$leftEyeY = 433;
$leftEyeX = 733;
// Get middle point of two eyes
$y = $rightEyeY - $leftEyeY;
$x = $rightEyeX - $leftEyeX;
$angle = rad2deg(atan2($y,$x)) - 180; // -6.8 degrees
$manager = new ImageManager(['driver' => 'imagick']);
$image = $manager->make('image.jpg')->rotate($angle);
$a = $angle * pi() / 180.0;
$cosa = cos($a);
$sina = sin($a);
$x = $x * $cosa - $y * $sina; // This one calculates x of the middle point not each eye.
$y = $x * $sina + $y * $cosa; // This one calculates y of the middle point not each eye.
我想要那些变量在顶部
FROM:
右眼 = 446
rightEyeX = 625
TO:
右眼 = 695
rightEyeX = 510
当我在 Photoshop 中将它旋转 -6.86
度时,它会逆时针旋转。但是在 Imagick 中,使用 -6.86
时它会顺时针旋转。
原始图像(右眼点:625x446):
Photoshop 中的旋转图像(右眼点:640x432):
使用 Imagick 旋转的图像(右眼点:695x510):
旋转后,图像的宽度/高度发生变化。所以获得右眼点的公式并没有给我们准确的点。
如何修复它并获得正确的视点?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)