Files
opencv/README.md
2025-03-17 10:19:27 +08:00

40 lines
641 B
Markdown

# @yizhi/opencv
简单的OpenCV封装
## 编译源码
1. 依赖
1. python3
1. cmake
1. ninja
1. c++编译器(gcc,clang,Visual Studio ...)
1. 编译OpenCV
```bash
node thirdpart/install.js --with-opencv
```
1. 编译本模块
```bash
cmake -B build -G Ninja . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
```
## 安装
```bash
npm install @yizhi/opencv
```
## 使用
```typescript
//导入opencv
import cv from '@yizhi/opencv';
//配置addon路径
cv.config("ADDON_PATH", "/path/to/cv.node");
//正常使用
const im = cv.imread("/path/to/input");
cv.resize(im, 640, 640);
cv.imwrite("/path/to/output", im);
```