When I calculate the similarity between two grayscale images in python and opencv, the function called compare_ssim() is reported incorrectly.
gray1 = cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY)
gray2 = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
(score, diff) = compare_ssim(gray1, gray2, full=True)
The error message is as follows:
TypeError: structural_similarity() takes 2 positional arguments but 8 were given
This is a function from library. From the _structural_similarity.py file.The directory is \skimage\measure\_structural_similarity.py.
def compare_ssim(X, Y, win_size=None, gradient=False,
data_range=None, multichannel=False, gaussian_weights=False,
full=False, **kwargs):
warn('DEPRECATED: skimage.measure.compare_ssim has been moved to '
'skimage.metrics.structural_similarity. It will be removed from '
'skimage.measure in version 0.18.', stacklevel=2)
return structural_similarity(X, Y, win_size, gradient,
data_range, multichannel, gaussian_weights,
full, **kwargs)
returnline, error message is displayed in this line.
And structural_similarity().The directory of this function is \skimage\metrics\_structural_similarity.py, the function is as follows:
def structural_similarity(im1, im2,
*,
win_size=None, gradient=False, data_range=None,
multichannel=False, gaussian_weights=False,
full=False, **kwargs):
What is the problem, why is this?