nebgnahz / cv-rs

Rust wrapper for OpenCV (manual at this point)
https://nebgnahz.github.io/cv-rs/cv/
MIT License
203 stars 41 forks source link

cv-rs

Build Status Build status standard-readme compliant

This library primarily provides idiomatic bindings and APIs for OpenCV 3.x.

Documentation

Table of Contents

Background

OpenCV (Open Source Computer Vision Library: http://opencv.org) is an open-source BSD-licensed library that includes several hundreds of computer vision algorithms. It's mainly developed in C++. This library provides Rust bindings to access OpenCV functionalities. First, C bindings are created (in native folder); then Rust APIs are constructed atop. Although this manual process seems an inefficient process, it has served me well as a learning experience to both OpenCV and Rust. In terms of OpenCV API coverage, modules and functions are implemented as needed.

Please check out the documentation to see what has been ported. If you have demand for porting specific features, please open an issue, or better create a PR.

Attempts to use rust-bindgen or cpp_to_rust haven't been very successful (I probably haven't tried hard enough). There is another port opencv-rust which generates OpenCV bindings using a Python script (more automated).

Install

Before anything, make sure you have OpenCV 3 installed. If you are using windows, follow this instruction, otherwise read this Introduction to OpenCV to get started.

Then in any Rust project, add this to your Cargo.toml:

[dependencies]
cv = { git = "https://github.com/nebgnahz/cv-rs.git" }

And add this to your crate:

extern crate cv;
use cv::*;

And then, enjoy the power of OpenCV.

If you'd like to use OpenCV GPU functions, it's inside cv::cuda. Enable it with the following code in Cargo.toml:

[dependencies.cv]
git = "https://github.com/nebgnahz/cv-rs"
features = [ "cuda" ]

All possible features are listed below:

Windows

If you are using MSVC toolchain (mandatory if you want to use CUDA)

Prerequisites
Installation steps

If you are using GNU toolchain

Prerequisites
Installation steps

Usage

See available examples on how this library might be used.

Contribute

See the contribute file! PRs highly welcome.

You may also simply open up an issue for feature/porting request.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © Ben Zhang