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

上海市经营性网站备案郑州seo排名哪有

上海市经营性网站备案,郑州seo排名哪有,张家港快速网站建设,wap静态模板1 cgg带你建个工程 如图 不然你的pip baidu-aip 用不了 先对图片进行一点处理 $ 灰度处理 $ 滤波处理 参考 import cv2 import os def preprocess_images(input_folder, output_folder):# 确保输出文件夹存在if not os.path.exists(output_folder):os.makedirs(output_fol…

1 cgg带你建个工程

如图 不然你的pip baidu-aip 用不了
在这里插入图片描述

先对图片进行一点处理

$ 灰度处理
$ 滤波处理
参考

import cv2
import os
def preprocess_images(input_folder, output_folder):# 确保输出文件夹存在if not os.path.exists(output_folder):os.makedirs(output_folder)# 获取输入文件夹中所有图片的文件名image_files = [f for f in os.listdir(input_folder) if f.lower().endswith(('.png', '.jpg', '.jpeg'))]# 初始化计数器count = 1for image_file in image_files:# 构建完整的输入文件路径input_path = os.path.join(input_folder, image_file)# 读取图片image = cv2.imread(input_path)if image is None:print(f"Warning: Unable to read image {input_path}")continue# 转换为灰度图gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 应用高斯滤波去除噪声blurred_image = cv2.GaussianBlur(gray_image, (5, 5), 0)# 构建输出文件名(如 a01.png)output_file = f"a{count:02d}{os.path.splitext(image_file)[1]}"output_path = os.path.join(output_folder, output_file)# 保存处理后的图片到文件cv2.imwrite(output_path, blurred_image)# 打印处理结果print(f"Processed {input_path} and saved as {output_path}")# 增加计数器count += 1print("Processing complete.")# 调用函数处理图片
input_folder = "C:\\Users\\Administrator\\Downloads\\ora"
output_folder = "C:\\Users\\Administrator\\Downloads\\pred"
preprocess_images(input_folder, output_folder)

然后再申请百度api

https://console.bce.baidu.com/ai/?_=1634647029968&fromai=1#/ai/ocr/overview/index

在这里插入图片描述

领 66

在这里插入图片描述

看文档,改代码

在这里插入图片描述

发现报错

pip  install  baidu-aip
pip  install  chardet

像我一样 setting 中 自己检查

在这里插入图片描述

识别代码


import os
from aip import AipOcr""" 你的 APPID AK SK """  # 换自己的,包子
APP_ID = '11&&&&&&79'
API_KEY = 'lenZRk17s88888888888'     # 换自己的,包子
SECRET_KEY = 'E7RjDl0L66666666…………………………'  # 换自己的,包子client = AipOcr(APP_ID, API_KEY, SECRET_KEY)""" 读取文件 """
# 假设您已经有一个OCR客户端实例,这里用伪代码表示
# client = YourOCRClientInitializer()  # 替换为实际的OCR客户端初始化代码def get_file_content(filePath):with open(filePath, "rb") as fp:return fp.read()def char_change(data):# 从字典中提取 'words_result' 列表words_list = data.get('words_result', [])  # 使用get方法以防'words_result'键不存在# 提取单词并组合,同时处理可能的连字符words = []for result in words_list:word = result.get('words', '')  # 使用get方法以防'words'键不存在# 根据需要移除连字符或其他不需要的字符word = word.replace('-', '').replace(' ', '')  # 也可以考虑移除空格words.append(word)# 使用空格或其他分隔符(如果需要的话)连接单词# 在这个例子中,我们假设车牌号应该是连续的,所以不使用分隔符combined_word = ''.join(words)# 输出结果print(combined_word)def process_images_in_folder(folder_path, ocr_client):# 遍历文件夹中的所有文件for filename in os.listdir(folder_path):# 检查文件扩展名,只处理图片文件if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.bmp', '.tiff')):file_path = os.path.join(folder_path, filename)# 读取图片内容image_content = get_file_content(file_path)# 调用OCR服务进行文字识别# 注意:这里假设ocr_client有一个名为basicGeneral的方法来处理图片# 并且该方法返回一个包含'words_result'键的字典recognition_result = ocr_client.basicGeneral(image_content)# 处理识别结果char_change(recognition_result)# 指定文件夹路径
folder_path = 'C:\\Users\\Administrator\\Downloads\\pred'
process_images_in_folder(folder_path,client)

http://www.hkea.cn/news/162234/

相关文章:

  • 关键词推广公司网站网络排名优化方法
  • 福州移动网站建设网络营销推广工具有哪些
  • win2008sr怎么用iis做网站国外网站加速
  • 合肥++网站建设磐石网站seo
  • 万网主机怎么上传网站如何在百度上投放广告
  • 做网站时如何给文字做超链接全球疫情最新数据消息
  • 四川省住建厅官方网站3分钟搞定网站seo优化外链建设
  • 做网站阳泉巨量千川广告投放平台
  • 温岭哪里有做网站的如何自制网站
  • 知道创于 wordpress搜索引擎优化宝典
  • 乌兰县wap网站建设公司有效获客的六大渠道
  • 微信网站开发教程视频教程百度一下主页官网
  • 网站开发专业前景关键词挖掘排名
  • 网站开发属于什么职位类别seo查询站长工具
  • wordpress postmetaseoul national university
  • 商务网站的主要存在形式杭州百度快照优化公司
  • 个人备案网站做购物网站可以不班级优化大师免费下载电脑版
  • 贸易网站建设互联网广告代理加盟
  • 深圳网站建设网络公司河北关键词排名推广
  • 在工商网上怎么注册公司seo优化博客
  • 免费的小程序怎么赚钱历下区百度seo
  • 河北石家庄最新疫情最新消息优化防疫政策
  • 一站式做网站哪家强新闻小学生摘抄
  • 江西南昌网站建设公司哪家好谷歌google 官网下载
  • 公司网站用什么开发百度指数怎么用
  • 建站主机 wordpress济南网站万词优化
  • 哈尔滨app开发seo自学网官网
  • 网站答辩ppt怎么做全网关键词云在哪里看
  • 网站建设 视频seo关键词词库
  • 网站应用软件设计成都网站建设技术外包