AttributeError: module 'cv2.cv2' has no attribute 'adaptiveBilateralFilter'

asked 2020-06-25 05:04:57 -0500

dejhost gravatar image

Hello everyone!

I'm pretty new to python/opencv, currently receiving the error message

AttributeError: module 'cv2.cv2' has no attribute 'adaptiveBilateralFilter'

My script looks like this:

 import cv2
 import numpy as np
 import argparse
 from PIL import Image

gray = cv2.imread('n101_0324.jpg', cv2.IMREAD_GRAYSCALE)

gray_filtered = cv2.bilateralFilter(gray, 5, 10, 10)
gray_adapt_filtered = cv2.adaptiveBilateralFilter(gray, 9, 10)

If I comment the last line, the script runs just fine.

If I ask sublime for the current version of opencv:

import cv2

, python tells me "3.4.9". So, an update might do the trick? Using the windows terminal, I see that the latest version is already installed:

C:\Windows\System32>pip install opencv-python==
Requirement already satisfied: opencv-python== in c:\users\jost\appdata\local\programs\python\python38- 
32\lib\site-packages (
 Requirement already satisfied: numpy>=1.17.3 in c:\users\jost\appdata\local\programs\python\python38-32\lib\site- 
packages (from opencv-python== (1.19.0)

I re-installed opencv and the opencv_contrib without any change. But since I am a bit confused about pip and non-pi installation... maybe so is python?

Please advice on how to sort this out. Thank you very much!

edit retag flag offensive close merge delete



a wild guess: it comes with it's own python and now you got 2 sneks with differing opencv versions ?

berak gravatar imageberak ( 2020-06-26 02:31:35 -0500 )edit

That makes perfect sense.

Looking at my env.Variable "path", it includes the folder "C:\Users\%USER%\AppData\Local\Programs\Python\Python38-32\Lib\site-packages", which contains the latest openCV version. Obviously Sublime "prefers" another available version. Can you please tell me how to straighten this up?

dejhost gravatar imagedejhost ( 2020-06-26 04:24:44 -0500 )edit


im not sure, but i read some things, that (starting with 3.8) they don't look at the PATH anymore

and sorry, we have no idea how you use sublime, how you run python progs from within there, it's not really an opencv problem ;(

berak gravatar imageberak ( 2020-06-26 04:35:01 -0500 )edit

I deinstalled sublime and am trying another way by now (python forum). But the following question still meets the topic: In which Version(s) is the "cv2.adaptiveBilateralFilter"-function implemented?

dejhost gravatar imagedejhost ( 2020-07-02 04:39:23 -0500 )edit

which Version

4.x, your 4.2.0 should definitely have it

berak gravatar imageberak ( 2020-07-02 04:44:41 -0500 )edit

No, sadly it was removed quite some time ago:

In case s.b. knows another implementation that I could use for R&D purposes, please share.

dejhost gravatar imagedejhost ( 2020-07-03 07:06:05 -0500 )edit