/eRum_2020_image_processing_and_computer_vision_with_R

A repository for purposes of eRum 2020's workshop "Image processing and computer vision with R", held on Saturday, June 20, 2020.

Primary LanguageR

[eRum 2020] Image processing and computer vision with R

This is a repository for purposes of a workshop Image processing and computer vision with R at eRum 2020.


Abstract

Although R is sometimes not considered as a number-one language for image processing, there are options for effectively handling these tasks in the R environment. Furthermore, a large R speaking community would like to combine image data analysis with other kinds of analyses by keeping all their code "under one roof" within R.

In this workshop, we will revisit available packages such as magick, imager, EBImage (and some others) written purely in R (and for R), which deal mainly with image processing. A couple of times will be dedicated to amazing Bnosac’s family of R packages enabling computer vision and some other algorithmic tasks, besides other, objects or face detection and recognition. We will also take a short look a bit deeper into state-of-the-art possibilities bridging the R environment to non-R-based libraries using API packages, namely employing of dlib R package.


How to prepare yourself before the workshop

To make things even smoother, it would be great when you install the following R packages before the beginning of the workshop. We are using lots of packages we are neither authors nor maintainers of, so all the credits go to their original authors!

  • The following packages,

bmp, jpeg, png, magick, tesseract, imager, OpenImageR, BiocManager, dlib, devtools, remotes,

could be installed one by one in RStudio or using the code below,

invisible(
    
    lapply(
        
        c(  
            "bmp",
            "jpeg",
            "png",
            "magick",
            "tesseract",
            "imager",
            "OpenImageR",
            "BiocManager",
            "dlib",
            "devtools",
            "remotes"
        ),
        function(my_package){
            
            if(
                !(
                    my_package %in% rownames(installed.packages())
                )
            ){
                
                install.packages(
                    my_package,
                    dependencies = TRUE,
                    repos = "http://cran.us.r-project.org"
                )
                
            }
            
        }
        
    )
    
)
  • The package "EBImage" is stored on Bioconductor rather than CRAN, so we need to install it following a kinda different code,
BiocManager::install("EBImage")
  • The Bnosac's family of R packages for computer vision requires Rtools, devtools, and should be installed from GitHub.
    • Firstly, if you haven't installed Rtools yet, click on https://cran.r-project.org/bin/windows/Rtools/ and please download the installer based on your operation system version. Install the Rtools.
    • Then, if you haven't customized your config file .Renviron ever before, copy and run the following command in R console
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

to set the correct paths to the Rtools.

  • Finally, install devtools using
install.packages("devtools")
  • Then, take a sip of coffee or rather two while you are installing Bnosac's packages using
devtools::install_github(
    "bnosac/image",
    subdir = "image.dlib",
    build_vignettes = TRUE
)

devtools::install_github(
    "bnosac/image",
    subdir = "image.darknet",
    build_vignettes = TRUE
)

devtools::install_github(
    "bnosac/image",
    subdir = "image.libfacedetection",
    build_vignettes = TRUE
)

We have checked that Bnosac's packages work appropriately on Windows computers. Linux systems are also recommended. We can't guarantee the codes' executions will perform well on Macs.


The second part of the workshop

Although the scripts for the second part of the workshop are included in this repo, you can find them also here, https://github.com/Kyoshido/workshop_e-Rum2020_darknet, by Jiri Novak.


Tutors

Lubomir Stepanek, MSc., M.D. is an assistant lecturer at the Department of Biomedical Statistics, Institute of Biophysics and Informatics, First Faculty of Medicine, Charles University, and tries to finish his Ph.D. somewhere around. He is absorbed by applied biostatistics, psychometrics, facial image processing, and computer vision.

Jiri Novak, MSc. is a teaching assistant and a Ph.D. student at the Department of Economic Statistics, Faculty of Informatics and Statistics, University of Economics. He is interested in Statistical Disclosure Control and R programming.