当 Params::Sigma < 1.0 时, EdgeDrawing::detectEllipses() 会修改调用者的输入图像
作者: purehol创建于 2026年9月2日更新于 2026年9月2日
系统信息 (版本)
- OpenCV => 4.x 头 (在 4.14.0 上重现)
- 操作系统/平台 => Ubuntu (Linux 5.15) 64 位
- 编译器 => gcc 9.4
详细描述
当 EdgeDrawing::Params::Sigma < 1.0 时, detectEdges() 会设置 smoothImage = srcImage; (modules/ximgproc/src/edge_drawing.cpp:411 在 4.x 上),因此 smoothImage 等同于调用者的输入 Mat。detectEllipses() 然后运行 GaussianBlur(srcImage, smoothImage, Size(), 0.50) (:2718) - 一个原地模糊,它会默默地覆盖用户的输入图像 (detectEdges() 在 :430 中的 PFmode 路径对 sigma 0.4 也做了同样的操作)。这违反了 InputArray 的只读约定,并且还会破坏源图像的任何后续使用。
内容来源: opencv/opencv_contrib