Skip to content

Commit

Permalink
Some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed May 22, 2018
1 parent 8c2e59d commit aaa981d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 19 deletions.
10 changes: 1 addition & 9 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
^\.Rproj\.user$
^windows$
^README.md$
^src/option_table.h$
^src/Makevars$
^tools/option_table.txt$
^R/sysdata.rda$
^src/*.def$
^appveyor\.yml$
^revdep$
^docker$
^httpbin.md$
^examples$
^release.R$
^LICENSE\.md$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: opencv
Type: Package
Title: Bindings to OpenCV
Version: 0.0
Version: 0.1
Authors@R: c(
person("Jeroen", "Ooms", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0002-4035-0289")))
Expand Down
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2018
COPYRIGHT HOLDER: Jeroen Ooms
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2018 Jeroen Ooms

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 7 additions & 3 deletions R/opencv.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#' OpenCV
#'
#' Utilities to read and write images with OpenCV.s
#' Utilities to read and write images with OpenCV.
#'
#' @export
#' @rdname opencv
#' @importFrom Rcpp sourceCpp
#' @useDynLib opencv
#' @param path image file such as png or jpeg
ocv_read <- function(path){
path <- normalizePath(path, mustWork = TRUE)
cvmat_read(path)
}

#' @export
#' @rdname opencv
#' @param image a ocv image object
ocv_write <- function(image, path){
path <- normalizePath(path, mustWork = FALSE)
cvmat_write(image, path)
Expand All @@ -37,8 +39,6 @@ ocv_camera <- function(){
}

#' @export
#' @rdname opencv
#' @param x passed to [print]
`print.opencv-image` <- function(x, ...){
viewer <- getOption("viewer")
is_knit_image <- isTRUE(getOption('knitr.in.progress'))
Expand All @@ -47,11 +47,14 @@ ocv_camera <- function(){
ocv_write(x, path = tmp)
viewer(tmp)
}
base::print.default(x)
#TODO: copy from magick
}

#' @export
#' @rdname opencv
#' @param width output width in pixels
#' @param height output height in pixels
ocv_resize <- function(image, width = 0, height = 0){
cvmat_resize(image, as.integer(width), as.integer(height))
}
Expand All @@ -76,6 +79,7 @@ ocv_knn <- function(image){

#' @export
#' @rdname opencv
#' @param filter an R function that takes and returns an opecv image
ocv_video <- function(filter){
if(!is.function(filter))
stop("Filter must be a function")
Expand Down
15 changes: 10 additions & 5 deletions man/opencv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void detectAndDraw( Mat img, CascadeClassifier& cascade,
}
}
t = (double)getTickCount() - t;
printf( "detection time = %g ms\n", t*1000/getTickFrequency());
//printf( "detection time = %g ms\n", t*1000/getTickFrequency());
for ( size_t i = 0; i < faces.size(); i++ )
{
Rect r = faces[i];
Expand Down

0 comments on commit aaa981d

Please sign in to comment.