cv2.error: OpenCV(4.8.1) :-1: error: (-5:Bad argument) in function ‘resize’
Overload resolution failed:
- Can’t parse ‘dsize’. Expected sequence length 2, got 3
- Can’t parse ‘dsize’. Expected sequence length 2, got 3
How to convert image to the same dimensions?
from skimage.metrics import structural_similarity
import cv2
import numpy as np
first = cv2.imread('1.png')
second = cv2.imread('3.png')
secondasnparray = np.asarray(second, dtype=int) # How to change this code properly???
second =cv2.resize(secondasnparray,first.shape)
first_gray = cv2.cvtColor(first, cv2.COLOR_BGR2GRAY)
second_gray = cv2.cvtColor(second, cv2.COLOR_BGR2GRAY)
score, diff = structural_similarity(first_gray, second_gray, full=True)
print("Similarity Score: {:.3f}%".format(score * 100))