Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

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

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

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

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

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

Using PycharmCE, python3.5, and opencv4

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

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

Using PycharmCE, python3.5, and opencv4

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError?AttributeError? PS I just tried

pip install opencv_contrib_python and the terminal responds with:

Requirement already satisfied: opencv_contrib_python in ./venv/lib/python3.7/site-packages (4.1.0.25) Requirement already satisfied: numpy>=1.14.5 in ./venv/lib/python3.7/site-packages (from opencv_contrib_python) (1.16.4)

soooo it should work right?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

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

Using PycharmCE, python3.5, and opencv4

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError? PS I just tried

pip install opencv_contrib_python and the terminal responds with:

Requirement already satisfied: opencv_contrib_python in ./venv/lib/python3.7/site-packages (4.1.0.25) Requirement already satisfied: numpy>=1.14.5 in ./venv/lib/python3.7/site-packages (from opencv_contrib_python) (1.16.4)

soooo it should work right?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

Even the docs say this module exists in opencv-contrib-python! https://docs.opencv.org/master/

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

Using PycharmCE, python3.5, and opencv4

I cannot figure out how to get the saliency module in Pycharm... I tried updating python, reinstalling pip, reinstalling opencv-contrib-python ( which threw me an error: 'ImportError: cannot import name main '. In Pycharm, I went to settings, Project Interpretor>Add>opencv-contrib-python and I also have opencv-python installed. Why do I still get an AttributeError? PS I just tried

pip install opencv_contrib_python and the terminal responds with:

Requirement already satisfied: opencv_contrib_python in ./venv/lib/python3.7/site-packages (4.1.0.25) Requirement already satisfied: numpy>=1.14.5 in ./venv/lib/python3.7/site-packages (from opencv_contrib_python) (1.16.4)

soooo it should work right?

My use of the saliency module:

    vs = VideoStream(src=0).start()
    sleep(0.2)

    frame = vs.read()
    frame = imutils.resize(frame, width=self.win_width)
    sa = cv.saliency.MotionSaliencyBinWangApr2014_create()
    sa.setImagesize(frame.shape[1], frame.shape[0])
    sa.init()
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    (success, saliencyMap) = sa.computeSaliency(gray)

Even the docs say this module exists in opencv-contrib-python! https://docs.opencv.org/master/