@appium/opencv

中文文档
6.0.0发布于 2026/11/15Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2.7万

OpenCV-related helper library

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. initOpenCv
  4. getImagesMatches
  5. getImagesSimilarity
  6. getImageOccurrence
  7. License

@appium/opencv

OpenCV-related helper methods

NPM version Downloads

Installation

npm install @appium/opencv

Usage

initOpenCv

Loads the opencv bindings. You only need to explicitly call this if you want to use your own opencv methods that are not included in this module.

import {initOpenCv} from '@appium/opencv';
await initOpenCv();

getImagesMatches

Calculates the count of common edges between two images. The images might be rotated or resized relatively to each other. See the function definition for more details.

import {getImagesMatches} from '@appium/opencv';
import {fs} from '@appium/support';

const image1 = await fs.readFile('image1.jpg')
const image2 = await fs.readFile('image2.jpg')
const {points1, rect1, points2, rect2, totalCount, count} = await getImagesMatches(image1, image2);

getImagesSimilarity

Calculates the similarity score between two images. It is expected that both images have the same resolution. See the function definition for more details.

import {getImagesSimilarity} from '@appium/opencv';
import {fs} from '@appium/support';

const image1 = await fs.readFile('image1.jpg')
const image2 = await fs.readFile('image2.jpg')
const {score} = await getImagesSimilarity(image1, image2);

getImageOccurrence

Calculates the occurrence position of a partial image in the full image. See the function definition for more details.

import {getImageOccurrence} from '@appium/opencv';
import {fs} from '@appium/support';

const fullImage = await fs.readFile('image1.jpg')
const partialImage = await fs.readFile('image2.jpg')
const {rect, score} = await getImageOccurrence(fullImage, partialImage);

License

Apache-2.0

版本与发布记录

@appium/opencv 共发布 66 个版本,首次发布于 2022/01/22;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.0.0latest2026/11/15今天
6.0.0-beta.7beta2026/11/132 天前
6.0.0-beta.62026/11/0115 天前
5.0.22026/10/2719 天前
6.0.0-beta.52026/10/2620 天前
6.0.0-beta.42026/10/1928 天前

其他发布通道:rc → 4.0.0-rc.1,beta → 6.0.0-beta.7。

关于 @appium/opencv 的常见问题

@appium/opencv 是什么?

OpenCV-related helper library

如何安装 @appium/opencv?

在项目目录运行 npm install @appium/opencv,或使用 pnpm add / yarn add / bun add。

@appium/opencv 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@appium/opencv 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@appium/opencv 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^22.22.2 || ^24.15.0 || >=26.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@appium/opencv 可以商用吗?

@appium/opencv 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@appium/opencv 的下载量有多少?

根据 npm 官方下载统计,@appium/opencv 在 2026/10/07 – 2026/11/05 这 30 天内被下载 27,313 次,日均约 910 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appium/opencv 还在维护吗?

最新版本 6.0.0 发布于 2026/11/15(今天);至今共发布 66 个版本,其中过去 12 个月发布了 20 个;首次发布于 2022/01/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。