All Projects → wangtonghe → Hq Answer Assist

wangtonghe / Hq Answer Assist

Licence: apache-2.0
百万英雄、冲顶大会等HQ类答题游戏辅助。Android、iOS均支持,推荐答案标红显示。

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Hq Answer Assist

Puloversmacrocreator
Automation Utility - Recorder & Script Generator
Stars: ✭ 803 (+792.22%)
Mutual labels:  tesseract
Lambda Packs
Precompiled packages for AWS Lambda
Stars: ✭ 997 (+1007.78%)
Mutual labels:  tesseract
Textshot
Python tool for grabbing text via screenshot
Stars: ✭ 1,163 (+1192.22%)
Mutual labels:  tesseract
Pytesseractid
使用 pytesseract ocr 识别 18 位身份证号
Stars: ✭ 23 (-74.44%)
Mutual labels:  tesseract
Ocrbot
An OCR (Optical Character Recognition) bot for Mastodon (and compatible) instances
Stars: ✭ 39 (-56.67%)
Mutual labels:  tesseract
Tesseract Python
Examples to implement OCR(Optical Character Recognition) using tesseract using Python
Stars: ✭ 49 (-45.56%)
Mutual labels:  tesseract
Tesseract.js
Pure Javascript OCR for more than 100 Languages 📖🎉🖥
Stars: ✭ 25,246 (+27951.11%)
Mutual labels:  tesseract
Penteract Ocr
⭐️ The native node.js bindings to the Tesseract OCR project.
Stars: ✭ 86 (-4.44%)
Mutual labels:  tesseract
Pan card ocr project
To extract details from Indian National Identification Cards such as PAN (completed) & Aadhar, Passport, Driving License (WIP) in a structured format
Stars: ✭ 39 (-56.67%)
Mutual labels:  tesseract
Ocr Electron Vue
📇 A Simple OCR Application built on Electron, Vue.js & Tesseract.js
Stars: ✭ 67 (-25.56%)
Mutual labels:  tesseract
Javascript Bcr Library
Offline business card reader
Stars: ✭ 24 (-73.33%)
Mutual labels:  tesseract
Recogcaptcha
Técnica de reconhecimento de captcha utilizando o framework AForge.NET e o Tesseract
Stars: ✭ 29 (-67.78%)
Mutual labels:  tesseract
Idmatch
Match faces on id cards with OCR capabilities.
Stars: ✭ 52 (-42.22%)
Mutual labels:  tesseract
Tesseract
A PHP wrapper for the Tesseract OCR engine
Stars: ✭ 19 (-78.89%)
Mutual labels:  tesseract
Text Scanner
OCR Android app using tesseract
Stars: ✭ 73 (-18.89%)
Mutual labels:  tesseract
Tesseract Ocr Scanner
基于Tesseract-OCR实现自动扫描识别手机号
Stars: ✭ 622 (+591.11%)
Mutual labels:  tesseract
Swiftytesseractrte
SwiftyTesseract Real-Time Engine
Stars: ✭ 49 (-45.56%)
Mutual labels:  tesseract
Mugen
A music video generator based on rhythm, built with moviepy and librosa
Stars: ✭ 88 (-2.22%)
Mutual labels:  tesseract
Koreader Base
Base framework offering a Lua scriptable environment for creating document readers
Stars: ✭ 81 (-10%)
Mutual labels:  tesseract
Lamiae
Lamiae - A Most Prestigious RPG Engine/Simulator derived from Cube 2 (Sauerbraten) and friends
Stars: ✭ 57 (-36.67%)
Mutual labels:  tesseract

hq-answer-assist

HQ类答题游戏辅助(python)

项目介绍

如百万英雄、冲顶大会、芝士超人等HQ类答题游戏辅助,可帮你搜索并匹配答案。原理同前一阵大火的跳一跳辅助类似,将答题页面截图,然后使用图片识别功能转成文字,再放到百度去搜索。

截图使用的是adb(对于Android)或wda(对于iOS,须有Mac电脑配合)。图片识别有 tesseract-orc和百度ocr两种方式, 相对来说百度ocr识别率高,不过有次数限制,而tesseract识别率稍低些,目前默认使用百度ocr。

具体思路如下:

  1. 答题时使用adb截图并将图片pull到本机
  2. 通过ocr图片识别题目
  3. 百度题目
  4. 百度后结果与选项做匹配,匹配度最高的即为推荐答案

项目结构

--- hq-answer-assist(根目录)

   --- config(屏幕分辨率配置目录)

   --- image (图片目录)
  
   --- .gitignore
  
   --- analyze.py (文字识别功能)
   
   --- baiduocr.py (百度OCR集成)
  
   --- config.json(配置文件)
  
   --- LICENSE
  
   --- main.py(主函数)
  
   --- README.md
   
   --- search.py(搜索函数)
   
   --- utils.py (工具函数)
  

使用说明

使用该脚本需保证以下环境安装

  1. python运行环境。
  2. 【Android】 android调试工具ADB,安装Android SDK后可在android_sdk/platform-tools/中找到。其他安装方式百度即可。
  3. 【iOS】安装facebook的iOS测试框架WebDriverAgent,具体安装教程详见iOS 真机如何安装 WebDriverAgent
  4. python若干类库:PIL(图片库)、BeautifulSoup(网页解析库)、pytesseract(图片文字识别库)、baidu-aip(百度ocr库)、facebook-wda。可使用python的pip安装。
  5. 文字识别引擎(可选,若使用百度云OCR可不安装)tesseract-ocr及中文简体语言包chi_sim.traineddata, 安装教程可百度,Mac安装教程在这里,其他系统可做参考。

使用百度OCR需在百度云创建应用,具体见百度云文字识别文档。 然后在配置文件config.json中配置baidu_ocrbaidu_ocr_config

{
  "auto": true,
  "baidu_ocr": true, 
  "baidu_ocr_config": { 
    "app_id": "xxx",
    "api_ley": "xxx",
    "secret_key": "xxx"
  },
  "debug": true,
  "is_ios":false
}

经测试,百度OCR识别度高且速度快,目前为默认配置。请自行配置百度OCR秘钥等信息**

答题时使用USB线连接PC,开启调试模式。目前有两种运行方式:手动和自动。默认为自动。配置在config.json中。将auto设置false则为手动。

手动

每次手机画面出现答题页面,手动执行python3 main.py命令。

自动

直接运行python3 main.py即可。程序会自主判断是否为答题页面。判断成功后自动图片识别并搜索。搜索出答案后停留10秒继续循环判断。目前每0.5秒判断一次。

配置文件

配置文件如下所示:

{
  "auto": true,
  "baidu_ocr": true,
  "baidu_ocr_config": {
    "app_id": "xxx",
    "api_key": "xxx",
    "secret_key": "xxx"
  },
  "debug": true,
  "is_ios": false
}

其中,auto用于设置手动、自动模式;baidu_ocrbaidu_ocr_config是百度ocr相关配置。debug是否开启debug模式,开启后会将每次答题截图信息保存以便分析。is_ios默认为false,表示为android,true为iOS。

结果展示

对知识性的问题准确率是很高的。

征集活动

由于部分题目及搜索原因,该辅助没有给出推荐答案,或是推荐错了,为方便今后改进, 可在Issues 6上贴出出错的问题,以便分析改进。 优先选取本应搜索到但却失败的知识性问题

改进意见

若大家有意见和建议,欢迎提出来一起探讨。多一个人参与项目才会更好。讨论地址 Issues 7

适配支持

屏幕分辨率适配在config/目录下,目前支持540x960640x1136,720x12801080x1920,1440x2560等分辨率。若没有你手机的分辨率。脚本会根据其他分辨率比例自动计算。

分辨率文件配置含义如下


{ 
  "question_area": {
    "x1": 23,
    "y1": 150,
    "x2": 510,
    "y2": 600
  },
  "blank_area": {
    "x1": 75,
    "y1": 150,
    "x2": 450,
    "y2": 600
  }
}

参数说明: question_area为 题目及选项区域,(x1,y1)为左上点左边,(x2,y2)为右下点坐标,由此组成的矩形区域。 blank_area表示答题页面上方特有的白条区域,用于在自动模式下判断是否为答题页面。表示的区域如下所示:

TODO

  1. 题目语义分析,只搜索题干关键字提高匹配度。
  2. 多路搜索,扩大搜索范围。百度知道、百度网页或作业帮、谷歌等多方位搜索。
  3. 优化结果匹配,设计合理的得分算法。
  4. 题目抓包,省去图片转文字时间,提高速度。

其他补充

经测试对百万英雄支持度稍高,其他次之。

tesseract识别文字偶尔会有误差。可训练以提高。

另由于题目本身原因,部分可能搜索不到答案或搜索有误,需自己留意那些奇怪的问题。

如果你遇到任何问题,可提Issues,为方便排查,请注明你的手机型号和分辨率。

如果你有更好的思路,欢迎分享讨论。欢迎贡献代码PR。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].