试图匹配两个图像以找出它们之间的分数。但它显示了一些尺寸错误。无法解决问题。我的代码如下:
from skimage.measure import compare_ssim
#import argparse
#import imutils
import cv2
img1="1.png"
img2="2.png"
# load the two input images
imageA = cv2.imread(img1)
imageB = cv2.imread(img2)
# convert the images to grayscale
grayA = cv2.cvtColor(imageA, cv2.COLOR_BGR2GRAY)
grayB = cv2.cvtColor(imageB, cv2.COLOR_BGR2GRAY)
# compute the Structural Similarity Index (SSIM) between the two
# images, ensuring that the difference image is returned
(score, diff) = compare_ssim(grayA, grayB, full=True)
diff = (diff * 255).astype("uint8")
print("SSIM: {}".format(score))
Run Code Online (Sandbox Code Playgroud)
这给 n 一个错误:
raise ValueError('Input images must have the …Run Code Online (Sandbox Code Playgroud) python image-processing python-imaging-library python-3.x python-imageio
我创建了一个 VBA 代码来删除列中可用的所有特殊字符。举个例子,我在一列的每个单元格中都有一个字母数字字符,其中包含一些特殊字符: 假设在一个单元格中我有一个值: abc@123!-245 执行我的代码后,我得到输出 abc 123 245 这里我的代码工作正常删除所有特殊字符。我的代码如下:
Sub ReplaceSpecial()
Dim cel As Range
Dim strVal As String
Dim i As Long
Application.ScreenUpdating = False
For Each cel In Selection
strVal = cel.Value
For i = 1 To Len(strVal)
Select Case Asc(Mid(strVal, i, 1))
Case 32, 48 To 57, 65 To 90, 97 To 122
' Leave ordinary characters alone
Case Else
Mid(strVal, i, 1) = " "
End Select
Next i
cel.Value = strVal
Next cel
Application.ScreenUpdating …Run Code Online (Sandbox Code Playgroud)