All Projects → ropensci → opencv

ropensci / opencv

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
R bindings for OpenCV

Programming Languages

C++
36643 projects - #6 most used programming language
r
7636 projects

Projects that are alternatives of or similar to opencv

ropsec
㊙️ Operations security for R developers
Stars: ✭ 27 (-78.05%)
Mutual labels:  unconf18, unconf
jobstatus
⛔ ARCHIVED ⛔ Send Live Status, Progress and Other Information Between Functions and Processes
Stars: ✭ 34 (-72.36%)
Mutual labels:  unconf18, unconf
middlechild
⛔ ARCHIVED ⛔ Tools to Intercept, Validate and Consume Web/Network Traffic
Stars: ✭ 15 (-87.8%)
Mutual labels:  unconf18, unconf
mchtoolbox
⛔ ARCHIVED ⛔ What the Package Does (Title Case)
Stars: ✭ 13 (-89.43%)
Mutual labels:  unconf18, unconf
pkgreviewr
R package to facilitate rOpenSci package reviews.
Stars: ✭ 35 (-71.54%)
Mutual labels:  unconf18, unconf
dataspice
🌶️ Create lightweight schema.org descriptions of your datasets
Stars: ✭ 151 (+22.76%)
Mutual labels:  unconf18, unconf
realtime
No description or website provided.
Stars: ✭ 15 (-87.8%)
Mutual labels:  unconf
data-packages
⛔ ARCHIVED ⛔
Stars: ✭ 23 (-81.3%)
Mutual labels:  unconf
dirdf
R package: dirdf - Extracts Metadata from Directory and File Names
Stars: ✭ 57 (-53.66%)
Mutual labels:  unconf
CV
Computer Vision applications using #Python and #OpenCV
Stars: ✭ 19 (-84.55%)
Mutual labels:  opencv-library
rcheatsheet
⛔ ARCHIVED ⛔ A package to create cheatsheets
Stars: ✭ 33 (-73.17%)
Mutual labels:  unconf
r-security-practices
⛔ ARCHIVED ⛔ Materials relating to security best practices for R people
Stars: ✭ 19 (-84.55%)
Mutual labels:  unconf
gendercoder
Creating R package to code free text gender responses
Stars: ✭ 48 (-60.98%)
Mutual labels:  unconf
Xamarin.Android.OpenCV
C# bindings for the OpenCV Android SDK
Stars: ✭ 87 (-29.27%)
Mutual labels:  opencv-library
checkers
⛔ ARCHIVED ⛔ Automated checking of best practices for research compendia ✔️
Stars: ✭ 53 (-56.91%)
Mutual labels:  unconf
miner
R package for controlling Minecraft via API
Stars: ✭ 74 (-39.84%)
Mutual labels:  unconf
Learnopencv
Learn OpenCV : C++ and Python Examples
Stars: ✭ 15,385 (+12408.13%)
Mutual labels:  opencv-library
cricketdata
International cricket data for men and women, Tests, ODIs and T20s
Stars: ✭ 66 (-46.34%)
Mutual labels:  unconf
PlayerDetection
Player detection and ball detection in football matches using image processing(opencv).
Stars: ✭ 50 (-59.35%)
Mutual labels:  opencv-library
styles
Custom themes for base plots
Stars: ✭ 32 (-73.98%)
Mutual labels:  unconf

Bindings to 'OpenCV' Computer Vision Library

Experimenting with computer vision and machine learning in R. This package exposes some of the available 'OpenCV' https://opencv.org/ algorithms, such as edge, body or face detection. These can either be applied to analyze static images, or to filter live video footage from a camera device.

CRAN_Status_Badge CRAN RStudio mirror downloads

Installation

On Windows and MacOS, the package can be installed directoy from CRAN:

install.packages("opencv")

Install from source

To install from source on MacOS, you need to install the opencv library from homebrew:

brew install opencv

On Ubuntu or Fedora you need libopencv-dev or opencv-devel:

sudo apt-get install libopencv-dev

For Ubuntu 16.04 (Xenial) and Ubuntu 18.04 (Bionic) we provide a PPA with more recent versions of OpenCV:

sudo add-apt-repository ppa:cran/opencv
sudo apt-get install libopencv-dev

And then install the R bindings:

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

Basic stuff:

Face recognition:

unconf <- ocv_read('https://jeroen.github.io/images/unconf18.jpg')
faces <- ocv_face(unconf)
ocv_write(faces, 'faces.jpg')

Or get the face location data:

facemask <- ocv_facemask(unconf)
attr(facemask, 'faces')

Live Webcam Examples

Live face detection:

library(opencv)
ocv_video(ocv_face)

Edge detection:

library(opencv)
ocv_video(ocv_edges)

Combine with Graphics

Replaces the background with a plot:

library(opencv)
library(ggplot2)

# get webcam size
test <- ocv_picture()
bitmap <- ocv_bitmap(test)
width <- dim(bitmap)[2]
height <- dim(bitmap)[3]

png('bg.png', width = width, height = height)
par(ask=FALSE)
print(ggplot2::qplot(speed, dist, data = cars, geom = c("smooth", "point")))
dev.off()
bg <- ocv_read('bg.png')
unlink('pg.png')
ocv_video(function(input){
  mask <- ocv_mog2(input)
  return(ocv_copyto(input, bg, mask))
})

Put your face in the plot:

# Overlay face filter
ocv_video(function(input){
  mask <- ocv_facemask(input)
  ocv_copyto(input, bg, mask)
})

Live Face Survey

Go stand on the left if you're a tidier

library(opencv)

# get webcam size
test <- ocv_picture()
bitmap <- ocv_bitmap(test)
width <- dim(bitmap)[2]
height <- dim(bitmap)[3]

# generates the plot
makeplot <- function(x){
  png('bg.png', width = width, height = height, res = 96)
  on.exit(unlink('bg.png'))
  groups <- seq(0, width, length.out = 4)
  left <- rep("left", sum(x < groups[2]))
  middle <- rep("middle", sum(x >= groups[2] & x < groups[3]))
  right <- rep("right", sum(x >= groups[3]))
  f <- factor(c(left, middle, right), levels = c('left', 'middle', 'right'),
              labels = c("Tidy!", "Whatever Works", "Base!"))
  color = I(c("#F1BB7B", "#FD6467", "#5B1A18"))
  plot(f, ylim = c(0, 5),
       main = "Are you a tidyer or baser?", col = color)
  dev.off()
  ocv_read('bg.png')
}

# overlays faces on the plot
ocv_video(function(input){
  mask <- ocv_facemask(input)
  faces <- attr(mask, 'faces')
  bg <- makeplot(faces$x)
  return(ocv_copyto(input, bg, mask))
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].