Python Forum

Full Version: Can't import package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to follow a tutorial for Image comparison.
https://www.pyimagesearch.com/2014/09/15...wo-images/
But as soon as i try
from skimage.measure import structural_similarity as ssim
it throws an exception:
Quote:Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
from skimage.measure import structural_similarity as ssim
ImportError: cannot import name 'structural_similarity' from 'skimage.measure' (C:\Users\Thomas\AppData\Local\Programs\Python\Python39\lib\site-packages\skimage\measure\__init__.py)

I have imported scikit-image with
Quote:pip install scikit-image
and it everything installed without problems.
I think it propably has to do with the different versions but I don't know how to fix it.
I hope someone can help me.
quick search shows that in ver 0.12 it was depreciated and renamed
Quote:measure.structural_similarity has been renamed measure.compare_ssim

further they were moved to different module, under different names

Quote:The following functions are deprecated and will be removed in 0.18: skimage.measure.compare_mse, skimage.measure.compare_nrmse, skimage.measure.compare_pnsr, skimage.measure.compare_ssim Their functionality still exists, but under the new skimage.metrics submodule under different names.

so, it should be this:
https://scikit-image.org/docs/stable/api...similarity

Not familiar and not sure if it will work, but you can try to

from skimage.metrics import structural_similarity as ssim