npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

captcha-cv-ocr

v1.1.2

Published

Verification code identification based on OCR (Tesseract) and CV (OpenCV)

Readme

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创建新的识别库,来适配其他各种验证码。

参考文档与额外说明

  • opencv4nodejs
    • Github | https://github.com/justadudewhohacks/opencv4nodejs
    • API | https://justadudewhohacks.github.io/opencv4nodejs/docs/Mat/
  • tesseract.js
    • 主页 | https://tesseract.projectnaptha.com/
    • Github | https://github.com/naptha/tesseract.js
    • API | https://github.com/naptha/tesseract.js#docs
    • 第三种验证码如果进行训练识别效果会更好
  • sharp
    • Github | https://github.com/lovell/sharp
    • API | https://sharp.pixelplumbing.com/api-constructor
    • 另外吐槽:只有编辑图像的基础功能,而且体验不是很理想需要绕过bug
  • ./lib/fakeOpenCV
    • 个人仿照 OpenCV 重写了一些图像算法

C++ / Python 的 OpenCV 海量资料也非常有帮助, 相应的函数基本都能在 opencv4nodejs 的 API 文档 里找到