An Image Processing Toolkit

Incorporates functions for image preprocessing, filtering and image recognition. The package takes advantage of 'RcppArmadillo' to speed up computationally intensive functions. The histogram of oriented gradients descriptor is a modification of the 'findHOGFeatures' function of the 'SimpleCV' computer vision platform, the average_hash(), dhash() and phash() functions are based on the 'ImageHash' python library. The Gabor Feature Extraction functions are based on 'Matlab' code of the paper, "CloudID: Trustworthy cloud-based and cross-enterprise biometric identification" by M. Haghighat, S. Zonouz, M. Abdel-Mottaleb, Expert Systems with Applications, vol. 42, no. 21, pp. 7905-7916, 2015, . The 'SLIC' and 'SLICO' superpixel algorithms were explained in detail in (i) "SLIC Superpixels Compared to State-of-the-art Superpixel Methods", Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Suesstrunk, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 34, num. 11, p. 2274-2282, May 2012, and (ii) "SLIC Superpixels", Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Suesstrunk, EPFL Technical Report no. 149300, June 2010.



The OpenImageR package is an image processing library. It includes functions for image preprocessing, filtering and image recognition. More details on the functionality of OpenImageR can be found in the first, second and third blog-posts, and in the package Documentation.

UPDATE 06-11-2018

As of version 1.1.2 the OpenImageR package allows R package maintainers to perform linking between packages at a C++ code (Rcpp) level. This means that the Rcpp functions of the OpenImageR package can be called in the C++ files of another package. In the next lines I'll give detailed explanations on how this can be done:


Assumming that an R package ('PackageA') calls one of the OpenImageR Rcpp functions. Then the maintainer of 'PackageA' has to :


  • 1st. install the OpenImageR package to take advantage of the new functionality either from CRAN using,

 
install.packages("OpenImageR")
 
 

or download the latest version from Github using the devtools package,


 
devtools::install_github('mlampros/OpenImageR')
 
 

  • 2nd. update the DESCRIPTION file of 'PackageA' and especially the LinkingTo field by adding the OpenImageR package (besides any other packages),

 
LinkingTo: OpenImageR
 

  • 3rd. open a new C++ file (for instance in Rstudio) and at the top of the file add the following 'headers', 'depends' and 'plugins',

 
# include <RcppArmadillo.h>
# include <OpenImageRheader.h>
// [[Rcpp::depends("RcppArmadillo")]]
// [[Rcpp::depends(OpenImageR)]]
// [[Rcpp::plugins(cpp11)]]
 
 

The available C++ classes (Utility_functions, Gabor_Features, Gabor_Features_Rcpp, HoG_features, Image_Hashing) can be found in the inst/include/OpenImageRheader.h file.


A complete minimal example would be :


 
# include <RcppArmadillo.h>
# include <OpenImageRheader.h>
// [[Rcpp::depends("RcppArmadillo")]]
// [[Rcpp::depends(OpenImageR)]]
// [[Rcpp::plugins(cpp11)]]
 
 
// [[Rcpp::export]]
arma::mat rgb_2gray(arma::cube RGB_image) {
 
  oimageR::Utility_functions UTLF;
  return UTLF.rgb_2gray(RGB_image);
}
 
 

Then, by opening an R file a user can call the rgb_2gray function using,


 
Rcpp::sourceCpp('example.cpp')              # assuming that the previous Rcpp code is included in 'example.cpp' 
             
set.seed(1)
im_rgb = array(runif(30000), c(100, 100, 3))
 
im_grey = rgb_2gray(im_rgb)
 
str(im_grey)
 

Use the following link to report bugs/issues,

https://github.com/mlampros/OpenImageR/issues

News

OpenImageR 1.1.5

  • I renamed the internal function norm_range_gauss to norm_matrix_range. Now, the norm_matrix_range function is accessible when loading the OpenImageR package. Moreover, I excluded rounding [ round() ], which occured by default in the norm_range_gauss function.

OpenImageR 1.1.4

  • I fixed the duplicated vignette title warning

OpenImageR 1.1.3

  • I fixed a documentation error as suggested in issue 11 of the OpenImageR Github repository (converted radians to degrees in all scripts of the OpenImageR package).

OpenImageR 1.1.2

  • I converted the OpenImageR package to a header-only package, so that Rcpp functions can be called from another R package.
  • I added the SLIC and SLICO superpixel algorithms as header files and as a function (superpixels()) which can be called from within R.
  • I added the load_3d_binary() function in case that a user intends to load 3d-image data from a binary file (as is the case when a user writes data when using the superpixels() function).
  • I added the RGB (Red-Green-Blue) to LAB (Lightness, A-colour-dimension, B-colour-dimension) colour conversion (RGB_to_Lab()).
  • I added the RGB (Red-Green-Blue) to HSV (Hue, Saturation, Value) colour conversion (RGB_to_HSV()).
  • I added the vignette "Image_segmentation_superpixels_clustering.Rmd"

OpenImageR 1.1.1

  • I modified the rotate_nearest_bilinear Rcpp function in the utils.cpp file to fix the ASAN-gcc error.

OpenImageR 1.1.0

  • I fixed the ASAN-gcc error.
  • I commented 3 test cases for the Solaris OS, otherwise it gives an error (see the comments in the test-gabor.R tests file).
  • I updated the Vignette Gabor Feature extraction.

OpenImageR 1.0.9

I added the GaborFeatureExtract R6 class, which as the name suggests extracts Gabor features from images (I updated the documentation and Vignettes too)

OpenImageR 1.0.8

I added the DARMA_64BIT_WORD flag in the Makevars file to allow the package processing big datasets

OpenImageR 1.0.7

I removed the threads parameter from the Augmentation function as there is no significant improvement (in execution speed) between a threaded and a non-threaded version. I modified the OpenMP clauses of the .cpp files to address the ASAN errors.

OpenImageR 1.0.6

I fixed a bug in the translation_mat function of the utils.cpp source file (https://github.com/mlampros/OpenImageR/issues/6 and https://github.com/mlampros/OpenImageR/issues/7). Moreover, I added the padded_value parameter in the translation and Augmentation R functions to allow the user to adjust the shifted values ( in case that shift_rows or shift_cols is not 0 ). The padded_value parameter can take either a numeric value or a numeric vector depending on the dimensions of the image. Previously, the shifted values were replaced by default with 0.

OpenImageR 1.0.5

I fixed a bug in the dhash function according to the Changelog of the imagehash python library. Moreover, I added a function to round float numbers in the image_hashing.cpp source file, otherwise by creating hash values using the bilinear interpolation method the returned values are incorrect.

OpenImageR 1.0.4

I modified the R script files to accept extension types similar to .tiff such as .tif, .TIFF or .TIF

OpenImageR 1.0.3

I modified the Augmentation function to correct an issue which occured due to the zca_comps parameter

OpenImageR 1.0.2

I did OpenMP optional for all cpp files due to the fact that the OSX OS does not currently support openMP ( r-devel-osx-x86_64-clang )

I removed the floor() function from the lines 45, 46 of the hog_features.cpp, because otherwise Solaris OS throws the following error:

  • error: call of overloaded ‘floor(int)’ is ambiguous

I can not fix the following error in the hog_features.cpp file for the r-oldrel-windows platform as it has either to do with the RcppArmadillo version or is GCC specific,

  • error: could not convert '{{-0x00000000000000001, 0, 1}, {-0x00000000000000002, 0, 2}, {-0x00000000000000001, 0, 1}}' from '' to 'arma::mat {aka arma::Mat}'

Platforms, which support newer versions of GCC (GCC >= 4.9.0) and a recent version of RcppArmadillo (>= 0.7) do not throw such an error.

OpenImageR 1.0.1

I modified the Makevars files, so that OpenImageR can be installed error-free in the following OS's,

  • r-devel-osx-x86_64-clang
  • r-patched-solaris-sparc
  • r-patched-solaris-x86
  • r-oldrel-windows-ix86+x86_64

OpenImageR 1.0.0

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("OpenImageR")

1.1.5 by Lampros Mouselimis, 9 months ago


https://github.com/mlampros/OpenImageR


Report a bug at https://github.com/mlampros/OpenImageR/issues


Browse source code at https://github.com/cran/OpenImageR


Authors: Lampros Mouselimis [aut, cre] , Sight Machine [cph] (findHOGFeatures function of the SimpleCV computer vision platform) , Johannes Buchner [cph] (average_hash , dhash and phash functions of the ImageHash python library) , Mohammad Haghighat [cph] (Gabor Feature Extraction) , Radhakrishna Achanta [cph] (Author of the C++ code of the SLIC and SLICO algorithms (for commercial use please contact the author))


Documentation:   PDF Manual  


GPL-3 license


Imports Rcpp, shiny, jpeg, png, tiff, utils, R6

Suggests testthat, knitr, rmarkdown, grid, covr

Linking to Rcpp, RcppArmadillo

System requirements: The package requires a C++11 compiler.


Imported by CNVScope, SuperpixelImageSegmentation, imagefluency.

Suggested by ClusterR.


See at CRAN