https://github.com/preco21/opencv-match
A Rust library that simplifies template matching with OpenCV
https://github.com/preco21/opencv-match
computer-vision image-processing opencv rust template-match template-matching
Last synced: 5 months ago
JSON representation
A Rust library that simplifies template matching with OpenCV
- Host: GitHub
- URL: https://github.com/preco21/opencv-match
- Owner: preco21
- License: mit
- Created: 2024-08-31T07:15:49.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-17T07:55:28.000Z (5 months ago)
- Last Synced: 2026-01-17T18:34:11.500Z (5 months ago)
- Topics: computer-vision, image-processing, opencv, rust, template-match, template-matching
- Language: Rust
- Homepage:
- Size: 289 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opencv-match
> A Rust library that simplifies template matching with OpenCV
## Prerequisites
This library is built on top of the [OpenCV](https://opencv.org/) library. You will need to have OpenCV installed on your system.
You can find the instructions [here](https://github.com/twistedfall/opencv-rust/blob/master/INSTALL.md).
Currently supports `v0.92.2` of the `opencv` crate.
[TODO: To make version selection more flexible]
## Install
The crate is not currently available on `crates.io`. You can add this library to your `Cargo.toml` with the following command:
```shell
cargo add --git https://github.com/preco21/opencv-match.git
```
## Features
- **Multiple template matching:** Detects and matches multiple instances of a template within a single image.
- **Non-maximum suppression:** Integrates [non-maximum suppression](https://builtin.com/machine-learning/non-maximum-suppression) to eliminate duplicate matches.
- **Directional clustering:** Clusters matching points vertically or horizontally into distinct sections, organizing them into bounding boxes for segmentation.
[TODO: Scale-invariant matching, Angle-invariant matching]
## Usage
[WIP]
## FAQ
### How can I link OpenCV statically in Windows?
Assuming you are using [`vcpkg`](https://vcpkg.io/), you install the static version of OpenCV with the following commands:
```powershell
vcpkg add zlib:x64-windows-static opencv4[contrib,nonfree]:x64-windows-static
vcpkg install zlib:x64-windows-static opencv4[contrib,nonfree]:x64-windows-static
```
This will take a while to build. After that, you can link the static libraries in your `Cargo.toml`:
```toml
[env]
OPENCV_LINK_LIBS = "zlib,opencv_core4,opencv_imgproc4"
OPENCV_INCLUDE_PATHS = "C:\\[PATH_TO_VCPKG]\\installed\\x64-windows-static\\include"
OPENCV_LINK_PATHS = "C:\\[PATH_TO_VCPKG]\\installed\\x64-windows-static\\lib"
OPENCV_MSVC_CRT = "static"
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
```
[WIP: Do we need OPENCV_LINK_LIBS explicitly specified?]