From 59b3c72be79fcb38e8ce5cdd4678194fe8452ad6 Mon Sep 17 00:00:00 2001 From: Lampros Mouselimis Date: Sat, 8 Jul 2023 10:38:03 +0300 Subject: [PATCH] fixed a bug related to #28 --- DESCRIPTION | 4 ++-- NEWS.md | 6 ++++++ R/open_image_rscript.R | 22 ++++++++++------------ README.md | 4 +--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8b8fdf28..97b4f7ab 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: OpenImageR Type: Package Title: An Image Processing Toolkit -Version: 1.2.9 -Date: 2023-05-23 +Version: 1.3.0 +Date: 2023-07-08 Authors@R: c( person("Lampros", "Mouselimis", email = "mouselimislampros@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "https://orcid.org/0000-0002-8024-1546")), person("Sight", "Machine", role = "cph", comment = "findHOGFeatures function of the SimpleCV computer vision platform"), person("Johannes", "Buchner", role = "cph", comment = "average_hash, dhash and phash functions of the ImageHash python library"), person("Mohammad", "Haghighat", email = "haghighat@ieee.org", role = "cph", comment = "Gabor Feature Extraction"), person("Radhakrishna", "Achanta", email = "Radhakrishna.Achanta@epfl.ch", role = "cph", comment = "Author of the C++ code of the SLIC and SLICO algorithms (for commercial use please contact the author)"), person("Oleh", "Onyshchak", role = "cph", comment = "Author of the Python code of the WarpAffine function") ) Maintainer: Lampros Mouselimis BugReports: https://github.com/mlampros/OpenImageR/issues diff --git a/NEWS.md b/NEWS.md index 3d565ebc..829a9351 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,10 @@ +## OpenImageR 1.3.0 + +* I updated the README.md file related to "[[Rcpp::plugins(cpp11)]]", which was removed in the previous version +* I fixed a bug in the internal *'func_chech_range()'* function (see issue: https://github.com/mlampros/OpenImageR/issues/28) + + ## OpenImageR 1.2.9 * I added an exception in the test-file *"test-norm_matrix_range.R"* related to Mac OSx and Power-PC (see issue: https://github.com/mlampros/OpenImageR/issues/27) diff --git a/R/open_image_rscript.R b/R/open_image_rscript.R index 04682aec..a2323bee 100644 --- a/R/open_image_rscript.R +++ b/R/open_image_rscript.R @@ -151,20 +151,18 @@ switch_filter = function(kernel, conv_mod, gaussian_dims = 5, sigma = 1.0, lapla #' @keywords internal func_chech_range = function(image) { - - if (inherits(image, 'matrix') && (max(image) != 1.0 || min(image) != 0.0)) { - - image = Normalize_matrix(image) - } - else if (inherits(image, 'array') && (max(Array_range(image, 1)) != 1.0 || min(Array_range(image, 2)) != 0.0)) { - - image = Normalize_array(image) - } - else { - + + if (inherits(image, 'matrix')) { + if ((max(image) != 1.0 || min(image) != 0.0)) { + image = Normalize_matrix(image) + } + } else if (inherits(image, 'array') && dim(image)[3] == 3) { + if (max(Array_range(image, 1)) != 1.0 || min(Array_range(image, 2)) != 0.0) { + image = Normalize_array(image) + } + } else { return(image) } - return(image) } diff --git a/README.md b/README.md index da79c037..473f133c 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ LinkingTo: OpenImageR # include // [[Rcpp::depends("RcppArmadillo")]] // [[Rcpp::depends(OpenImageR)]] -// [[Rcpp::plugins(cpp11)]] ``` @@ -94,7 +93,6 @@ A *complete minimal example* would be : # include // [[Rcpp::depends("RcppArmadillo")]] // [[Rcpp::depends(OpenImageR)]] -// [[Rcpp::plugins(cpp11)]] // [[Rcpp::export]] @@ -226,7 +224,7 @@ If you use the code of this repository in your paper or research please cite bot title = {{OpenImageR}: An Image Processing Toolkit}, author = {Lampros Mouselimis}, year = {2023}, - note = {R package version 1.2.9}, + note = {R package version 1.3.0}, url = {https://CRAN.R-project.org/package=OpenImageR}, } ```