Skip to content

A Rust library that simplifies template matching with OpenCV

License

Notifications You must be signed in to change notification settings

preco21/opencv-match

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencv-match

A Rust library that simplifies template matching with OpenCV

Prerequisites

This library is built on top of the OpenCV library. You will need to have OpenCV installed on your system.

You can find the instructions here.

Currently supports v0.92.2 of the opencv crate.

[TODO: Make version selection more flexible]

Install

Currently not available on crates.io. You can add this library to your Cargo.toml with the following command:

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 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, you install the static version of OpenCV with the following commands:

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:

[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?]

Releases

No releases published

Packages

No packages published

Languages