【Emgu CV教程】5.7、几何变换之LogPolar()极坐标变换

上一篇讲完了LinearPolar()函数用法,Emgu CV里面还有一个LogPolar()函数,它是这样定义的:

public static void LogPolar(
	IInputArray src,  // 输入图像
	IOutputArray dst, // 输出图像
	PointF center, // 极坐标变换中心,一般就是图像的中心
	double M, // 尺度参数ρ = M × l o g ( r ) 
	Inter interpolationType = Inter.Linear, // 插值算法
	Warp warpType = Warp.FillOutliers //与interpolationType 配合使用
)

高等数学基本忘了,网上的解释也不多,所以我也没弄清LogPolar()函数的意义以及到底用在哪里合适,还是直接上代码吧,读者们自己去理解,还是以这张378*378的印章为例。
在这里插入图片描述

使用以下代码:

Mat tempMat = srcMat.Clone();
Mat dstMat = new Mat();
Mat dstRotate90 = new Mat();
Mat dstInverted = new Mat();
PointF center = new PointF(tempMat.Cols / 2, tempMat.Rows / 2);
double m = 55;
CvInvoke.LogPolar(tempMat, dstMat, center, m, Inter.Linear, Warp.FillOutliers);
CvInvoke.Rotate(dstMat, dstRotate90, RotateFlags.Rotate90CounterClockwise);
CvInvoke.LogPolar(dstMat, dstInverted, center, m, Inter.Linear, Warp.InverseMap);
CvInvoke.Imshow("LogPolar image, " + dstMat.Size.ToString(), dstMat);
CvInvoke.Imshow("LogPolar image rotate 90 , " + dstRotate90.Size.ToString(), dstRotate90);
CvInvoke.Imshow("LogPolar image inverted, " + dstInverted.Size.ToString(), dstInverted);

依次得到极坐标转换后的图片dstMat,dstMat逆时针旋转90度的图片dstRotate90,dstMat极坐标逆转换回来的图片dstTnverted,三张图如下:
在这里插入图片描述

中间那幅图,“联合国教科文组织不正常人类研究” 和 “中心” 基本变成水平方向排列的连贯文字了。

提示:使用完LogPolar()函数后,一定要再将图像逆时针旋转90度,才能得到我们正常习惯的图片。

原创不易,请勿抄袭。共同进步,相互学习。

  • 17
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值