diff --git a/.Rbuildignore b/.Rbuildignore index 2f8584e..7ef2c2f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -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$ diff --git a/DESCRIPTION b/DESCRIPTION index 5445f78..7846313 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "jeroen@berkeley.edu", comment = c(ORCID = "0000-0002-4035-0289"))) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8b5d4b0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2018 +COPYRIGHT HOLDER: Jeroen Ooms diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..bebab97 --- /dev/null +++ b/LICENSE.md @@ -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. diff --git a/R/opencv.R b/R/opencv.R index cf5d614..4cc0e29 100644 --- a/R/opencv.R +++ b/R/opencv.R @@ -1,11 +1,12 @@ #' 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) @@ -13,6 +14,7 @@ ocv_read <- function(path){ #' @export #' @rdname opencv +#' @param image a ocv image object ocv_write <- function(image, path){ path <- normalizePath(path, mustWork = FALSE) cvmat_write(image, path) @@ -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')) @@ -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)) } @@ -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") diff --git a/man/opencv.Rd b/man/opencv.Rd index 14a9a59..4705060 100644 --- a/man/opencv.Rd +++ b/man/opencv.Rd @@ -6,7 +6,6 @@ \alias{ocv_bitmap} \alias{ocv_edges} \alias{ocv_camera} -\alias{print.opencv-image} \alias{ocv_resize} \alias{ocv_face} \alias{ocv_mog2} @@ -24,8 +23,6 @@ ocv_edges(image) ocv_camera() -\method{print}{opencv-image}(x, ...) - ocv_resize(image, width = 0, height = 0) ocv_face(image) @@ -37,8 +34,16 @@ ocv_knn(image) ocv_video(filter) } \arguments{ -\item{x}{passed to [print]} +\item{path}{image file such as png or jpeg} + +\item{image}{a ocv image object} + +\item{width}{output width in pixels} + +\item{height}{output height in pixels} + +\item{filter}{an R function that takes and returns an opecv image} } \description{ -Utilities to read and write images with OpenCV.s +Utilities to read and write images with OpenCV. } diff --git a/src/util.cpp b/src/util.cpp index b766daf..da26ef0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -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];