
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
captcha-cv-ocr
Advanced tools
Verification code identification based on OCR (Tesseract) and CV (OpenCV)
使用 CV (OpenCV) 和 OCR (Tesseract) 进行验证码识别
simplest | grids_and_equations | dots_and_chars | ... |
---|---|---|---|
![]() | ![]() | ![]() | ... |
2348 | 2x6=? | 7RVO | ... |
因为所需的 OpenCV 支持模块 opencv4nodejs 体积较大,编译过程复杂,请手动安装,或者参考官方的安装指南:
npm i opencv4nodejs -g
第三种验证码识别改为用 sharp 和纯 JavaScript 的 CV 算法来实现,方便在树莓派上运行,但效率相比前两者很低。
第二个 Tesseract 支持模块为 tesseract.js
直接安装
npm i captcha-cv-ocr
或者
git clone https://github.com/PillarsZhang/captcha-cv-ocr
cd captcha-cv-ocr
npm install
npm link #约等于安装为全局模块
node judge_and_test.js
const path = require("path");
const cvocrModule = require("captcha-cv-ocr");
var mode = "simplest";
(async () => {
let cvocr = new cvocrModule(mode); // mode 表示验证码的种类
await cvocr.init(1); //其中的1表示需要启动的 OCR Worker 数(多线程)
let ans = await cvocr.recognize(path.join(__dirname, "docs/img", mode + ".jpg")); //支持文件地址、Base64、Buffer形式
console.log("ans:", ans)
process.exit(0);
})()
simplest | grids_and_equations | dots_and_chars |
---|---|---|
![]() | ![]() | ![]() |
2348 | 2x6=? | 7RVO |
codes下的文件夹对应着不同种类的名字(自行命名),你可以参照已有的模板与API创建新的识别库,来适配其他各种验证码。
C++ / Python 的 OpenCV 海量资料也非常有帮助, 相应的函数基本都能在 opencv4nodejs 的 API 文档 里找到
FAQs
Verification code identification based on OCR (Tesseract) and CV (OpenCV)
We found that captcha-cv-ocr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.