【问题标题】:openCV vs GIMP, edge detection fails in openCVopenCV vs GIMP,openCV中的边缘检测失败
【发布时间】:2011-06-03 11:35:18
【问题描述】:

我正在使用以下参数在 openCV 中进行 Sobel 边缘检测:

cv.Sobel(mat, edgemat, 1, 1)
# mat -> source image
# edgemat -> taget output image 
# 1 -> xorder (int) – Order of the derivative x
# 1 -> yorder (int) – Order of the derivative y
# apertureSize (int) – Size of the extended Sobel kernel -> its by default set to 3

我还使用 GIMP 对图像进行了 Sobel 边缘检测。

源图片为: openCV 的输出是 GIMP 的输出是

为什么 openCV 和 GIMP 的输出差异如此之大。 GIMP 的输出质量超过 openCV 光年。

【问题讨论】:

  • openCV 被描述为实时计算机视觉。 openCV 的运行时间与 GIMP 相比如何?

标签: python opencv gimp edge-detection


【解决方案1】:

简单的回答:你做错了。请参阅the documentation - 你正在做的是计算图像的d^2/(dx dy) 导数 - 这意味着“水平边缘如何垂直变化”(或者,等效地,“垂直边缘如何水平变化”),这意味着,对于垂直或水平边缘,您期望输出为零(因为它不会在垂直于它的方向上改变)。所以,你用你的 opencv 线做的根本不是边缘检测。您可能想要类似 sobel 的东西,以 1, 0 作为参数和 0, 1,然后将这些结果平方并将它们相加,然后取结果的平方根。这可能会导致类似于 GIMP 所做的事情。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多