python polar函数_比较python中opencv lineartoPolar()转换

本文探讨了在Python中使用OpenCV的linearToPolar函数将二维功率谱从笛卡尔坐标转换为极坐标的挑战。作者遇到转换结果与预期不符的问题,通过查阅文档和函数帮助,尝试理解函数的工作原理,特别是中心点定义和尺度参数的影响。
摘要由CSDN通过智能技术生成

我的目标是将二维功率谱从笛卡尔坐标转换为极坐标。在imshow(np.log10(psd2shift),cmap=cm.jet)

3d20562842d86ba89ff51e5657fc0223.png

stackoverflow上有几篇关于如何做到这一点的文章,比如link。所以我相信我的密码是正确的。在

^{pr2}$

4ea750af82c2841703d8ca4e2e803d7d.png

尽管如此,我还是得不到我想要的:

7f083a1c5a7641ff7019886b8ea072f9.png

显然,在转换中有一个差异,尽管我已经深入研究了linearPolar函数或文档here,但我还是未能揭示这一点。似乎中心的定义不正确,但我很确定是。想法?在

使用help(cv.linearPolar)

退货:

关于内置函数linearPolar的帮助:linearPolar(...)

linearPolar(src, center, maxRadius, flags[, dst]) -> dst

. @brief Remaps an image to polar coordinates space.

.

. @anchor polar_remaps_reference_image

. ![Polar remaps reference](pics/polar_remap_doc.png)

.

. Transform the source image using the following transformation:

. \f[\begin{array}{l}

. dst( \rho , \phi ) = src(x,y) \\

. dst.size() \leftarrow src.size()

. \end{array}\f]

.

. where

. \f[\begin{array}{l}

. I = (dx,dy) = (x - center.x,y - center.y) \\

. \rho = Kx \cdot \texttt{magnitude} (I) ,\\

. \phi = Ky \cdot \texttt{angle} (I)_{0..360 deg}

. \end{array}\f]

.

. and

. \f[\begin{array}{l}

. Kx = src.cols / maxRadius \\

. Ky = src.rows / 360

. \end{array}\f]

.

.

. @param src Source image

. @param dst Destination image. It will have same size and type as src.

. @param center The transformation center;

. @param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.

. @param flags A combination of interpolation methods, see cv::InterpolationFlags

.

. @note

. - The function can not operate in-place.

. - To calculate magnitude and angle in degrees @ref cv::cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值