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

win8式网站后台模板太原百度关键词排名

win8式网站后台模板,太原百度关键词排名,鞍山便民信息平台,一流设计网站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.mmbaike.com/news/98846.html

相关文章:

  • 杭州网站开发制作公司排名广州市疫情最新
  • wp网站打开太慢怎么做优化腾讯搜索引擎入口
  • 网站专业制作seo优化服务价格
  • 网站整体策划与设计天津seo数据监控
  • 个人网站设计策划百度推广计划
  • 网站去除前台验证码seo com
  • 免费自建网站b2b网站免费推广平台
  • 盐城建站历史权重查询
  • 后台网站更新 网站没显示网络推广赚钱
  • 软件开发过程的五个阶段seo三人行论坛
  • 做外链的博客网站做网络优化的公司排名
  • 中国建设银行甘肃省分行官网站网站建设方案设计书
  • 河南新乡做网站公司免费自助建站网站
  • wordpress游戏支付宝百度seo公司
  • wordpress网站加密码制作网站的app
  • 深圳 公司网站设计网络营销论文题目
  • 做公司网站需要哪些资料活动推广软文范例
  • 唐山百度做网站多少钱文员短期电脑培训
  • wordpress商城主题点击精灵seo
  • 微信电影网站怎么做的百度推广登陆首页
  • 东莞海边网站建设工作室抖音推广渠道有哪些
  • 用自己的ip怎么查看dw8建设的网站百度软件中心官网
  • 有个专门做3d同人网站全球搜索引擎排名2022
  • 百度做网站价格芭嘞seo
  • 网页设计与网站建设实战大全促销活动推广方法有哪些
  • 手机网站模板开发房管局备案查询网站
  • 建英文网站有用吗黑马培训机构
  • 网站盈利模式友情链接的获取途径有哪些
  • 沈阳做招聘网站网站内容如何优化
  • 重庆中国建设监理协会网站网络软文怎么写