Python (OpenCV) 中值滤波器问题
我需要对 Python 中的一些图像进行(快速)中值滤波器,在 Google 上一段时间后,似乎 OpenCV 是追求速度的方法(即使在 Python 中也是如此)。我启动并运行了 OpenCV,并且像 Erode 和 Dilate 这样的过滤器工作正常:
cv.Erode(cv_im,cv_im,None,6)
cv.Dilate(cv_im,cv_im,None,6)
然而,中值过滤器似乎不起作用:
cv.Smooth(cv_im,cv_im,CV_MEDIAN)
“NameError:全局名称'CV_MEDIAN'未定义”
我似乎无法弄清楚我要做什么根据文档http://opencv.willowgarage.com/documentation/python/image_filtering.html#smooth 看起来我的做法是正确的。
有什么想法吗? 非常感谢!
I need to do a (fast) median filter of some images from Python, and after some time on Google it seems like OpenCV is the way to go for speed (even in Python). I got OpenCV up and running, and filters like Erode and Dilate works fine:
cv.Erode(cv_im,cv_im,None,6)
cv.Dilate(cv_im,cv_im,None,6)
The Median filter, however, does not seem to work:
cv.Smooth(cv_im,cv_im,CV_MEDIAN)
"NameError: global name 'CV_MEDIAN' is not defined"
I can't seem to figure out what I'm doing wrong, according to the documentation http://opencv.willowgarage.com/documentation/python/image_filtering.html#smooth it looks like I do it the correct way.
Any ideas?
Many thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您将 pyopencv 导入为“
cv
”。因此,您将CV_MEDIAN
编辑为cv.CV_MEDIAN
应该会有所帮助Looks like you imported pyopencv as "
cv
". So you edittingCV_MEDIAN
tocv.CV_MEDIAN
should help