Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写我自己的Canny 边缘检测算法版本。我的问题是,如何计算梯度的方向?我已经知道了:
但是当G y = G x = 0时我该怎么办?
我认为你给 theta 的值实际上并不重要,因为 Gx 和 Gy 等于 0 意味着没有梯度,这意味着没有边缘。该像素没有边缘,因此它也没有边缘方向的角度。检测何时 Gy=gx=0 并在 theta 中写入您想要的任何内容。
哦!但不要忘记 arctan(Inf)=pi/2!如果只有 Gx 的值为零,请记住您有结果!
编辑:在图像中,所有黑色区域都没有渐变,因此没有角度。