Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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
 import cv2
 import numpy as np
 import argparse
 from PIL import Image

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

#Filter
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
print(cv2.__version__)

, 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==4.2.0.34
Requirement already satisfied: opencv-python==4.2.0.34 in c:\users\jost\appdata\local\programs\python\python38- 
32\lib\site-packages (4.2.0.34)
 Requirement already satisfied: numpy>=1.17.3 in c:\users\jost\appdata\local\programs\python\python38-32\lib\site- 
packages (from opencv-python==4.2.0.34) (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!