0

Here's the part that involves the use of skimage in the code:

from skimage import metrics

....

print(metrics.mean_squared_error(gray_frame, canny_img))
print(metrics.peak_signal_noise_ratio(gray_frame, canny_img))

Here's the error:


C:\Users\user\Desktop>python cannyopencv2.py
Traceback (most recent call last):
  File "cannyopencv2.py", line 6, in <module>
    from skimage import metrics
ImportError: cannot import name 'metrics' from 'skimage' (C:\ProgramData\Anaconda3\lib\site-packages\skimage\__init__.py)

Please help me get rid of it.

Infinity
  • 153
  • 2
  • 10

2 Answers2

1

Try to install latest version of skimage because that version does not have that module in it so use below command to upgrade it!

pip install scikit-image -U

or

pip install scikit-image --upgrade

Bhavya Parikh
  • 3,304
  • 2
  • 9
  • 19
0

You need to install the package first in order to use it.

pip install scikit-image or pip3 install scikit-image

docs

yapancha
  • 51
  • 8
  • 1
    I think it is already installed as you can see from error traceback there is a folder created after installation – Bhavya Parikh May 14 '21 at 13:41
  • 1
    I think @BhavyaParikh might be on the right track here. You have the package installed, maybe it is the version issue. See similar post [here](https://stackoverflow.com/questions/55178229/importerror-cannot-import-name-structural-similarity-error) – yapancha May 14 '21 at 13:45
  • @yapancha exactly – Infinity May 15 '21 at 13:44