简体   繁体   English

如何实现 scipy.ndimage.convolve1d

[英]how to implement scipy.ndimage.convolve1d

I have a code on python I like to convert it to c++.我在 python 上有一个代码,我喜欢将其转换为 c++。

I have a probleme in this line how can I implement it in cpp.我在这一行有一个问题,如何在 cpp 中实现它。

thank you谢谢你

    y = scipy.ndimage.convolve1d(x1, x2, mode="constant")

You can use OpenCV filter2D function.您可以使用 OpenCV filter2D function。 Also you can try it in python to see if it does the thing that you want, it's pretty fast.您也可以在 python 中尝试它,看看它是否能完成您想要的事情,它非常快。

But if you want to implement the 1d convolution, the naïve implementation is just basically two nested for loops.但是如果你想实现一维卷积,简单的实现基本上就是两个嵌套的 for 循环。 Discrete convolution . 离散卷积

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM