Trying to use BRISQUE but 'quality' module is not recognized

Hey, I’m trying to implement image quality assessment into my project and would like to use BRISQUE to generate a quality score.

From the documentation, the python code should be:

cv.quality.QualityBRISQUE.compute( img )

but ‘quality’ after cv is not being recognized.

I’ve installed opencv-contrib-python to gain access to the extra modules that should include ‘quality’. Also, I have implemented these lines

import cv2 as cv
img = cv.imread(path)
grey = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
blurScore = cv.Laplacian(grey, cv.CV_64F).var()

so I am getting some functionality out of OpenCV.

Is there something I am missing in my attempt to implement BRISQUE image quality assessment?

Disclaimer: I’m very new to Python, haven’t finished my Comp Sci degree yet, and my brain is melting due to banging my head against such a simple problem. Hopefully the solution isn’t too obvious, but it feels like it should be.

is there any chance you installed both opencv-python and opencv-contrib-python ? they get in each others way (there can only be 1 cv2), and you only need the latter, so try to uninstall opencv-python


My first attempt I had installed opencv-python first, then uninstalled to install opencv-contrib-python. Today I created a new anaconda environment to completely start fresh and I’m still experiencing the same issue without ever touching opencv-python.

but how can you experience the same issue when the issue involves OpenCV and you haven’t even installed it yet?

I mean I installed opencv-contrib-python by itself in a fresh environment. So my issue does not involve the opencv-python package being installed at the same time. I should have access to the quality module, but still do not.

ah, right.

anyway… your call to that static method lacks some arguments (file paths).

only the instance’s method can be called without them (because they would have been given in the construction).

the model files can be found in opencv_contrib/modules/quality/samples/