CSC/ACM

CSC/ACM:----就是一个协议,通过这个协议,可以用usb设备模拟串口。

USB CDC (Communications Device Class)

ACM(Abstract Control Model) is a vendor-independent publicly documentedprotocol that can be used for emulating serial ports over USB

support:

device drivers------->

[*]usb support------>

<*>usb modem(cdc/acm) support

gadget support

serial gadget


如果你想要在`locateOnScreen`函数中进行模糊匹配(即允许一定程度的位置误差),可以使用`locateAllOnScreen`函数,它返回的是所有相似图像的坐标列表,而不是仅仅第一个匹配项。这个函数可以根据像素相似度设置阈值,使得搜索结果更为宽容。 以下是修改后的代码片段,添加了模糊查询参数: ```python from PIL import ImageGrab import numpy as np import cv2 import pytesseract from pyautogui import locateAllOnScreen, Image def fuzzy_search(image_path, threshold=50): # 设置默认的相似度阈值 original_image = Image.open(image_path) grayscale_image = original_image.convert('L') pixels = np.array(grayscale_image) # 使用Tesseract识别图片上的文字,如果有文字干扰,可以移除这一行 text = pytesseract.image_to_string(grayscale_image) if pytesseract.check_for_tesseract() else "" # 使用OpenCV进行模糊匹配 result_images = locateAllOnScreen(image_path, confidence=threshold / 100) # OpenCV使用confidence替代PyAutoGUI的threshold result_locations = [] for img in result_images: result_img = ImageGrab.grab(bbox=img) result_grayscale = result_img.convert('L') result_pixels = np.array(result_grayscale) # 计算像素之间的差异 difference = np.abs(pixels - result_pixels).mean() # 如果差异小于设定的阈值,则认为匹配成功 if difference <= threshold: result_locations.append(img) return result_locations, text # 调用模糊匹配函数,并处理结果 image_path = 'E:/csc/csc.PNG' locations, text = fuzzy_search(image_path) if locations: print(f"找到了类似图像的位置: {locations}") else: print("未找到匹配的图像")
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值