README.md

InstaRF Proposal

Build Status

Contributors:

Betty Zhou Linyang Yu Reza Bagheri Simon Chiu

Overview

Image processing uses computer algorithms to enhance an image or to extract useful information from it. In this package, we have implemented some R functions for image processing. These functions perform Gaussian blurring, Laplacian edge detection, and color changing.

Functions

  1. Gaussian Blur This function performs convolution to de-emphasize differences in adjacent pixel values with a Gaussian distribution. The blurring effect removes detail and noise in the input image.
  2. Laplacian Edge Detecting This function performs convolution to emphasize differences in adjacent pixel values. The function detects edges by sharpening/highlighting the edges of an image.
  3. RBG Manipulation This function adjusts the red, blue and green intensity of an image by applying different weights for each RBG channel. This is similar to a colour filter in Instagram.

R Ecosystem

It is important to note that are several packages that have similar image processing functionality. For example, InstaR is a R package that contains the three functions: blur, flip and greyscale to transform images. Or a similar package called magick exists which has some image processing filters like blur, crop and trim. In this project, we plan to implement three more image processing functions in R by exploring additional filters.

Repo structure:

InstaRF

Installation

Installing InstaRF is easy with only the following two steps:

  1. Open your R studio
  2. Enter devtools::install_github("UBC-MDS/InstaRF", build_opts = c("--no-resave-data", "--no-manual")) to console.

To build vignettes:

  1. devtools::install_github("UBC-MDS/InstaRF", build_opts = c("--no-resave-data", "--no-manual"))
  2. browseVignettes(package ='InstaRF')

Usage

library(InstaRF)

Functions

1. Gaussian Blur

gaussian_blur(input_image_path, output_image_path, sigma = 1)

Arguments:

Example:

gaussian_blur("tests/testthat/test_img/carnovsky_RGB_1.png", "tests/testthat/test_img/test.png", sigma = 1)

Before:

After:

2. RGB manipulation

RGB_manipulation(input_path, output_path, R = 2, G = 2, B = 2)

Arguments:

Example: RGB_manipulation(""tests/testthat/test_img/carnovsky_RGB_1.png", "tests/testthat/test_img/Carnovsky_RGB_manipulated.png", R = 1, G = 1, B = 5)

Before:

After:

3. Laplacian Edge Detecting

laplacian_edge_detecting(input_image, output_image)

Arguments:

Example:

laplacian_filter("tests/testthat/test_img/test_img_laplacian_bird_before.png", "tests/testthat/test_img/test_img_laplacian_bird_after.png")

Before:

After:

Branch coverage

The package passed all the tests that were planned before.

It had 100% branch coverage:

The functions passed all the tests:

and R cmd test was also passed:

Unit tests results

In the root of the repository, input devtool::test() or devtool::check(), the former will generate the test units reports and the later will give you a full report of the package.

Results for devtool::test()

Package dependencies

|||| |---|---|---| |testthat|png|spatialfil|



UBC-MDS/InstaRF documentation built on May 15, 2019, 4:10 a.m.