An open API service indexing awesome lists of open source software.

https://github.com/brownag/rvfc

Experimental Rcpp bindings to 'Vector Field Consensus' VFC algorithm after Ma et al. (2014) w/ OpenVC
https://github.com/brownag/rvfc

Last synced: about 2 months ago
JSON representation

Experimental Rcpp bindings to 'Vector Field Consensus' VFC algorithm after Ma et al. (2014) w/ OpenVC

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# {rvfc}

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

The goal of {rvfc} is to provide bindings for 'Vector Field Consensus' based on code provided in Ma et al. (2014).

> Jiayi Ma, Ji Zhao, Jinwen Tian, Alan Yuille, and Zhuowen Tu. (2014) "Robust Point Matching via Vector Field Consensus", IEEE Transactions on Image Processing, 23(4), pp. 1706-1721. doi: 10.1109/TIP.2014.2307478.

For additional details on the algorithm, see: [https://www.cs.jhu.edu/~ayuille/Pubs10_12/TIP2014.pdf](https://www.cs.jhu.edu/~ayuille/Pubs10_12/TIP2014.pdf)

## Installation

> NOTE: this is an experimental package that is allowing me to tinker with Rcpp and OpenCV. Feel free to use it but it is presently just one of many projects that I do as a proof of concept, mostly for myself.

You can install the development version of {rvfc} by first installing {opencv}.

Follow the {opencv} instructions to install: . At present this package does not depend on {opencv}, it "Enhances," it. To support independence of the two packages, and as part of the proofi of concept, a limited amount of glue code has been used from {opencv}, so special thanks to authors of that package (Jeroen Ooms and Jan Wijffels).

You will need to install the relevant binaries (e.g. _libopencv-dev_ on Ubuntu) for your platform, and then install the R bindings. On Windows/Mac you can use CRAN or r-universe to get appropriate, recent binaries.

For instance (on Ubuntu):

``` sh
sudo apt install libopencv-dev
```

Then install from source, linking to your shared OpenCV libraries:

``` r
install.packages("opencv", type = "source")
```

Then, you can install the development version of {rvfc} from GitHub:

``` r
if (!requireNamespace("remotes"))
install.packages("remotes")

remotes::install_github("brownag/rvfc")
```

## Example

This is an experimental example of using the {opencv} `"opencv-image"` class as input to a method. Currently (v0.0.0.9001) `compare()` is just a demonstration function. It is hard-coded to use `cv:ORB` feature detection/descriptor extraction, with `n=500` keypoints initially. These `cv::KeyPoints` are reduced to a smaller set (mismatches removed) using the VFC algorithm. This information (indices of matches, between 1 and 500) is not presently "useful," as the keypoint coordinates are not made available in this demo function, nor are they an input (yet).

Future interfaces will integrate more with functionality available in {opencv}.

```{r example}
library(rvfc)

c1 <- system.file("extdata", "image", "church1.jpg", package="rvfc")
c2 <- system.file("extdata", "image", "church2.jpg", package="rvfc")

a <- opencv::ocv_read(c1)
a

b <- opencv::ocv_read(c2)
b

x <- compare(a, b)
x
```