STAT545-hw-Ganelin-Ilya

Owner: IG

Date: 26/11/17

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

The goal of rgb2yuv is to practice functions created in the class and create a few more useful functoins. The fuctions also performs a test on the default input.

Input:

Data

Example

## basic example code that saves luma component from the RGB png file
rgb2luma("img.png")
## basic example code that saves chroma1 component from the RGB png file
rgb2chroma1("img.png")
## basic example code that saves chroma2 component from the RGB png file
rgb2chroma2("img.png")
## basic example code that saves grey image out of RGB png file
rgb2grey("img.png")

Notes:

I had a lot of problems with including png package into the project. I literally spent ours on that, read everything on the net, but at the end decided that the user will have other means, so I followed the advice from VIncenzo in class and used only base functions. Another problem was with the save img.rda file that I wanted to use as a default, but found no documentation what so ever on how to do it. I tried a few approaches, but it didn't work as well. So the final version is relying only on the base function and the example is a simple instruction on how to use it. I did however included the data file.

Tests:

devtools::install_github("ilgan/rgb2yuv")
library(png)
img <- readPNG("angry.png") #or use any other available png file
luma <- rgb2luma(img)
png('luma.png')
plot(c(0,1),c(0,1),t='n')
rasterImage(luma, 0,0,1,1)
dev.off()


ilgan/rgb2yuv documentation built on May 22, 2019, 1:38 p.m.