开发者

Python (OpenCV) Median filter trouble

开发者 https://www.devze.com 2023-04-09 05:21 出处:网络
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

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:

开发者_如何学JAVA
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!


Looks like you imported pyopencv as "cv". So you editting CV_MEDIAN to cv.CV_MEDIAN should help

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号