OpenCV极坐标转换函数warpPolar的使用

发布时间:2022-09-29 20:00

OPenCV版本:4.4

IDE:VS2019

功能描述

将图像重新映射到极坐标或半对数极坐标空间,这个函数用于实现图像的极坐标变换。
OpenCV极坐标转换函数warpPolar的使用_第1张图片
使用以下变换来转换图像:
d s t ( ρ , ϕ ) = s r c ( x , y ) dst(\rho , \phi ) = src(x,y) dst(ρ,ϕ)=src(x,y)
此处:
I ⃗ = ( x − c e n t e r . x ,    y − c e n t e r . y ) ϕ = K a n g l e ⋅ angle ( I ⃗ ) ρ = { K l i n ⋅ magnitude ( I ⃗ ) d e f a u l t K l o g ⋅ l o g e ( magnitude ( I ⃗ ) ) i f    s e m i l o g \begin{array}{l} \vec{I} = (x - center.x, \;y - center.y) \\ \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ \rho = \left\{\begin{matrix} Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ \end{matrix}\right. \end{array} I =(xcenter.x,ycenter.y)ϕ=Kangleangle(I )ρ={Klinmagnitude(I )Klogloge(magnitude(I ))defaultifsemilog

并且:
K a n g l e = d s i z e . h e i g h t / 2 Π K l i n = d s i z e . w i d t h / m a x R a d i u s K l o g = d s i z e . w i d t h / l o g e ( m a x R a d i u s ) \begin{array}{l} Kangle = dsize.height / 2\Pi \\ Klin = dsize.width / maxRadius \\ Klog = dsize.width / log_e(maxRadius) \\ \end{array} Kangle=dsize.height/2ΠKlin=dsize.width/maxRadiusKlog=dsize.width/loge(maxRadius)

线性与半对数映射
极坐标映射可以是线性或半对数,添加WarpPolarMode中的一个到flags来确定极坐标映射模式,。
线性是缺省模式。
半对数映射模拟人类的“中心凹”视觉,允许在视线(中心视觉)上具有非常高的锐度,而周围视觉的锐度较小。

dsize的选项:

  • 如果dsize中的两个值均<=0(默认),则目标图像将具有(几乎)相同的源边界圆面积
    d s i z e . a r e a ← ( m a x R a d i u s 2 ⋅ Π ) d s i z e . w i d t h = cvRound ( m a x R a d i u s ) d s i z e . h e i g h t = cvRound ( m a x R a d i u s ⋅ Π ) \begin{array}{l} dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ dsize.width = \texttt{cvRound}(maxRadius) \\ dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ \end{array} dsize.area(maxRadius2Π)dsize.width=cvRound(maxRadius)dsize.height=cvRound(maxRadiusΠ)
  • 如果只是 dsize.height <= 0,目标图像区域将与边界圆区域按比例Kx * Kx:缩放。
    d s i z e . h e i g h t = cvRound ( d s i z e . w i d t h ⋅ Π ) \begin{array}{l} dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ \end{array} dsize.height=cvRound(dsize.widthΠ)
  • 如果dsize所有的成员的值都 > 0, 目标图像将具有给定的大小,因此边界圆的面积将缩放为dsize.

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号