在opencv中,是否有Matlab的边缘(I,方法,阈值)等效的方法=' zerocross'?

发布于 2025-02-09 05:37:08 字数 131 浏览 0 评论 0原文

我需要将以下行从MATLAB转换为CPP,并得到完全相同的结果:

im_zerocross = 
double(edge(im,'zerocross',0));

任何帮助都将不胜感激。

I need to translate the following line from matlab to cpp and get the exact same result:

im_zerocross = 
double(edge(im,'zerocross',0));

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮光之海 2025-02-16 05:37:08

MATLAB中的零交叉边缘检测器是OpenCV中Laplacian操作员的代名词。

它在图像中沿x和y方向找到了二阶导数。此结果中的每个零交叉都对应于图像中的边缘。

用法:

import cv2

# read image in grayscale
img = cv2.imread('apple.jpg',0)

# apply Laplacian operator
laplacian = cv2.Laplacian(img,cv2.CV_64F)

最后一个参数cv2.cv_64f是在float数据类型中给出结果,类似于double> double> double

通过此帖子以获取详细信息和相关代码

Zero crossing edge detector in MATLAB is synonymous to Laplacian operator in OpenCV.

It finds the second order derivatives along X and Y directions in the image. Every zero crossing in this result corresponds to an edge in the image.

Usage:

import cv2

# read image in grayscale
img = cv2.imread('apple.jpg',0)

# apply Laplacian operator
laplacian = cv2.Laplacian(img,cv2.CV_64F)

The last parameter cv2.CV_64F is to give the result in float data type similar to double in MATLAB.

Go through this post for details and relevant code

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文