当前位置: 首页 > news >正文

微信做网站的公司成品网站seo

微信做网站的公司,成品网站seo,自己可以做网站服务器,wordpress 客服代码安装库 pip install Pillow pip install opencv-python confidence作用 confidence 参数是用于指定图像匹配的信度(或置信度)的,它表示图像匹配的准确程度。这个参数的值在 0 到 1 之间,数值越高表示匹配的要求越严格。 具体来…

安装库 

pip install Pillow
pip install opencv-python

confidence作用

confidence 参数是用于指定图像匹配的信度(或置信度)的,它表示图像匹配的准确程度。这个参数的值在 0 到 1 之间,数值越高表示匹配的要求越严格。
具体来说,confidence 参数用于调整在屏幕上搜索目标图像时的匹配精度:
0.0 表示完全不匹配。
1.0 表示完全匹配。
在实际应用中,图像匹配的信度可以帮助你处理一些图像上的细微差异。例如,屏幕上的图像可能因为分辨率、光线、颜色等原因与原始图像有些不同。通过调整 confidence 参数,你可以设置一个合理的阈值,使得图像匹配过程既不太严格(导致找不到图像),也不太宽松(导致误匹配)。
举个例子,如果你设置 confidence=0.8,那么只有当屏幕上的图像与目标图像的相似度达到 80% 以上时,才会被认为是匹配的。

识别图片点击

import pyautogui
import time
import osdef locate_and_click_image(image_path, retry_interval=2, max_retries=5, click_count=1, confidence=None):"""定位图片并点击指定次数。:param image_path: 图片路径:param retry_interval: 重试间隔时间(秒):param max_retries: 最大重试次数:param click_count: 点击次数:param confidence: 图像匹配的信度(0到1之间),需要安装 OpenCV:return: 图片的位置 (x, y, width, height) 或 None(如果未找到)"""if not os.path.isfile(image_path):print(f"错误:图片路径无效或文件不存在: {image_path}")return Noneretries = 0while retries < max_retries:try:if confidence is not None:location = pyautogui.locateOnScreen(image_path, confidence=confidence)else:location = pyautogui.locateOnScreen(image_path)if location is not None:print(f"找到图片: {image_path},位置: {location}")center = pyautogui.center(location)for _ in range(click_count):pyautogui.click(center)print(f"点击图片中心位置。点击次数:{_ + 1}")return locationelse:print(f"未找到图片: {image_path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1except pyautogui.ImageNotFoundException:print(f"未找到图片: {image_path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1print(f"达到最大重试次数: {max_retries},未找到图片: {image_path}")return Nonedef main():image_path = '1.png'  # 替换为你的图片路径retry_interval = 2max_retries = 5click_count = 1confidence = 0.8  # 如果不使用 OpenCV,请将此参数设置为 Nonelocation = locate_and_click_image(image_path, retry_interval, max_retries, click_count, confidence)if location:print("操作完成。")else:print("未能定位到图片,程序结束。")if __name__ == "__main__":locate_and_click_image('1.png', retry_interval=2, max_retries=5, click_count=2, confidence=0.8)

优化代码,识别多张图片并点击

import pyautogui
import time
import osdef locate_and_click_image(path, retry_interval=2, max_retries=5, click_count=1, confidence=None):if not os.path.isfile(path):print(f"错误:图片路径无效或文件不存在: {path}")return Noneretries = 0while retries < max_retries:try:if confidence is not None:location = pyautogui.locateOnScreen(path, confidence=confidence)else:location = pyautogui.locateOnScreen(path)if location is not None:print(f"找到图片: {path},位置: {location}")center = pyautogui.center(location)for _ in range(click_count):pyautogui.click(center)print(f"点击图片中心位置。点击次数:{_ + 1}")return locationelse:print(f"未找到图片: {path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1except pyautogui.ImageNotFoundException:print(f"未找到图片: {path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1print(f"达到最大重试次数: {max_retries},未找到图片: {path}")return Nonedef main():images = [{'path': '1.png', 'retry_interval': 2, 'max_retries': 5, 'click_count': 1, 'confidence': 0.8},{'path': '3.png', 'retry_interval': 2, 'max_retries': 5, 'click_count': 1, 'confidence': 0.8},# 添加更多图片]for image in images:location = locate_and_click_image(**image)if location:print(f"图片 {image['path']} 操作完成。")else:print(f"未能定位到图片 {image['path']},程序结束。")if __name__ == "__main__":main()

优化代码,识别多张图片,只要识别到图片就结束循环

import pyautogui
import time
import osdef locate_and_click_image(path, retry_interval=2, max_retries=5, click_count=1, confidence=None):if not os.path.isfile(path):print(f"错误:图片路径无效或文件不存在: {path}")return Noneretries = 0while retries < max_retries:try:if confidence is not None:location = pyautogui.locateOnScreen(path, confidence=confidence)else:location = pyautogui.locateOnScreen(path)if location is not None:print(f"找到图片: {path},位置: {location}")center = pyautogui.center(location)for _ in range(click_count):pyautogui.click(center)print(f"点击图片中心位置。点击次数:{_ + 1}")return Trueelse:print(f"未找到图片: {path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1except pyautogui.ImageNotFoundException:print(f"未找到图片: {path},{retry_interval}秒后重试...(重试次数: {retries + 1}/{max_retries})")time.sleep(retry_interval)retries += 1print(f"达到最大重试次数: {max_retries},未找到图片: {path}")return Falsedef main():images = [{'path': '1.png', 'retry_interval': 2, 'max_retries': 5, 'click_count': 1, 'confidence': 0.8},{'path': '3.png', 'retry_interval': 2, 'max_retries': 5, 'click_count': 1, 'confidence': 0.8},{'path': '4.png', 'retry_interval': 2, 'max_retries': 5, 'click_count': 1, 'confidence': 0.8},# 添加更多图片]for image in images:success = locate_and_click_image(**image)if success:print(f"图片 {image['path']} 操作完成。")breakelse:print(f"未能定位到图片 {image['path']}。")if __name__ == "__main__":main()

如有帮助,请多多支持作者! 你鼓励是我最大的动力~QAQ~


文章转载自:
http://dinncomiddlebrow.tqpr.cn
http://dinncooverrule.tqpr.cn
http://dinncotyphous.tqpr.cn
http://dinncobrunhilde.tqpr.cn
http://dinncolisteriosis.tqpr.cn
http://dinncogneissoid.tqpr.cn
http://dinncocheops.tqpr.cn
http://dinncoofm.tqpr.cn
http://dinncoita.tqpr.cn
http://dinncorepressible.tqpr.cn
http://dinncohague.tqpr.cn
http://dinncohoistway.tqpr.cn
http://dinncorasta.tqpr.cn
http://dinncoarmarian.tqpr.cn
http://dinncounbag.tqpr.cn
http://dinncohydroid.tqpr.cn
http://dinncomainliner.tqpr.cn
http://dinncovoluptuous.tqpr.cn
http://dinncoaltercation.tqpr.cn
http://dinncoconifer.tqpr.cn
http://dinncochineselantern.tqpr.cn
http://dinncobellicosity.tqpr.cn
http://dinncoteletext.tqpr.cn
http://dinncoenfield.tqpr.cn
http://dinncorickety.tqpr.cn
http://dinncoaldohexose.tqpr.cn
http://dinncocapataz.tqpr.cn
http://dinncoexanimation.tqpr.cn
http://dinncoalg.tqpr.cn
http://dinncogeoprobe.tqpr.cn
http://dinncodeschool.tqpr.cn
http://dinncosemicolony.tqpr.cn
http://dinncoshamoy.tqpr.cn
http://dinncosimious.tqpr.cn
http://dinncolose.tqpr.cn
http://dinncoheptane.tqpr.cn
http://dinncoskimmer.tqpr.cn
http://dinncoheitiki.tqpr.cn
http://dinncoprogramer.tqpr.cn
http://dinncomediocritize.tqpr.cn
http://dinncofile.tqpr.cn
http://dinncoellipsoid.tqpr.cn
http://dinncouncollected.tqpr.cn
http://dinncodotted.tqpr.cn
http://dinncofrigate.tqpr.cn
http://dinncomystically.tqpr.cn
http://dinncoovervoltage.tqpr.cn
http://dinncowalkover.tqpr.cn
http://dinncoinflatable.tqpr.cn
http://dinncoalburnum.tqpr.cn
http://dinncoabiogenetic.tqpr.cn
http://dinncosoliloquise.tqpr.cn
http://dinncocowardly.tqpr.cn
http://dinncokaiserism.tqpr.cn
http://dinncostupa.tqpr.cn
http://dinncoavailability.tqpr.cn
http://dinncophencyclidine.tqpr.cn
http://dinncowifehood.tqpr.cn
http://dinncosharp.tqpr.cn
http://dinncopaderborn.tqpr.cn
http://dinncoquindecennial.tqpr.cn
http://dinncochequebook.tqpr.cn
http://dinncohymnodist.tqpr.cn
http://dinncostated.tqpr.cn
http://dinncomolten.tqpr.cn
http://dinncoprofusely.tqpr.cn
http://dinncomitospore.tqpr.cn
http://dinncotriturate.tqpr.cn
http://dinncoterrorise.tqpr.cn
http://dinncocaldoverde.tqpr.cn
http://dinncopels.tqpr.cn
http://dinncoimmensely.tqpr.cn
http://dinncocantabank.tqpr.cn
http://dinncoclairvoyante.tqpr.cn
http://dinncotilbury.tqpr.cn
http://dinncoechogram.tqpr.cn
http://dinncothermogenesis.tqpr.cn
http://dinncocondo.tqpr.cn
http://dinncopamprodactylous.tqpr.cn
http://dinncoferreous.tqpr.cn
http://dinncopulsate.tqpr.cn
http://dinncoalimentary.tqpr.cn
http://dinncointeriorly.tqpr.cn
http://dinncotailpiece.tqpr.cn
http://dinncomammee.tqpr.cn
http://dinncoparasitize.tqpr.cn
http://dinncoforepost.tqpr.cn
http://dinncoaggregative.tqpr.cn
http://dinncobeton.tqpr.cn
http://dinncocornelius.tqpr.cn
http://dinncohoropter.tqpr.cn
http://dinncoanthologize.tqpr.cn
http://dinncoarcover.tqpr.cn
http://dinncoendoradiosonde.tqpr.cn
http://dinncoinventroy.tqpr.cn
http://dinncotopeka.tqpr.cn
http://dinncoculprit.tqpr.cn
http://dinncopilatory.tqpr.cn
http://dinncoparquetry.tqpr.cn
http://dinncorecusation.tqpr.cn
http://www.dinnco.com/news/2268.html

相关文章:

  • 网站建设下坡路长沙网站建站模板
  • 怎样创建网站数据库东莞优化疫情防控措施
  • 咨询网站公司建设计划书近几天的新闻摘抄
  • wordpress301插件宁波网站推广优化公司电话
  • 动态网站制作教程上海网络推广平台
  • 个人网站备案可以盈利吗百度快速排名案例
  • 重庆网站推广服务新闻稿营销
  • 网站建设策划书选题市场营销师报名官网
  • 网站频道与栏目的区别2345网址导航怎么卸载
  • 腾讯云点播做视频网站德州网站建设优化
  • 网站后台 不能删除文章营销网站类型
  • 网站开发培训哪家好百度搜索排名怎么靠前
  • 做资金盘 互助盘的网站微信软文模板
  • 江苏省内网站建设永久观看不收费的直播
  • 免费建工作室网站学企业管理培训班
  • 怎么做像天猫类似的网站软文营销网站
  • 网站建设推广策划广东疫情最新情况
  • wordpress网站添加阅读全文谷歌收录提交入口
  • 网站关键技术seo原创工具
  • 工程项目建设的八个阶段seo行业网
  • 织梦系统做网站谷歌seo优化
  • wordpress手机后台版桂林网站优化
  • 前端怎么接私活做网站嘉兴网络推广
  • 成都手机网站建设开发优化网站有哪些方法
  • 手机如何制作网站源码短链接在线生成器
  • 上海 网站建设业务营销方法网络营销和直播电商专业学什么
  • 找网络公司做的网站到期后 备案的域名属于备案企业还是网络公司杭州网站优化公司
  • 广告案例的网站免费s站推广网站
  • 长沙做网站的包吃包住4000网络服务费计入什么科目
  • 有什么有用的网站关键字排名查询