hsbhist: Provide image HSB(HSV) color space histogram

Description Usage Arguments Value Examples

Description

Analysis an image from .bmp, .jpg(.jpeg) and .png file. Draw Hue, Saturation, and Brightness(Value) color space histogram of pixel in ggplot2. HSB color space computed from RGB value. Calculate mean, sd, skewness, and kurtsis for each histogram.

Usage

1
2
hsbhist(input, mode = "file", output = input, hist = TRUE,
  resize = FALSE, endoff = FALSE, textsize = 16)

Arguments

input

Set file, folder or url for image analysis corresponding to mode parameter.

mode

Select a mode in all four modes. Modes are "file"(default), "url", "folder", and "scraping".

output

Set the name of output histogram and data. Each mode have default output name.

hist

Whether histogram draw or not. Dafult is draw. However, you should set FALSE when you want fast computation for images of digital camera and smartphone. Rendering of ggplot2 is so long for these large pixels image.

resize

This argument is important to process many image histogram fastly. If you set resize=1/4 or 1/8, the speed of drawing histogram is dramatically up although output values are approximation. Resize value indicate image compression ratio. Resize is recommended when you use folder mode and want to get many histogram.

endoff

If you want to get rid of image borders extreme value (white or black frame), you set this parameter TRUE.

textsize

Font size of histogram caption. Dafult setting is textsize=16.

Value

image histogram and thier descriptive stastics (HSB color space). Folder and scraping mode provide a pdf file. Range of all values are 0-1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Simple use is only set input an image file name. Japanese file name is accepted.
originaidir <- getwd()  # get current dir
setwd(system.file("extdata", package="imhistR"))  # set analysis dir
hsbhist("Newlogo.png", endoff=TRUE)
setwd(originaidir)      # set original dir

# hsbhist("yourfile.jpg")  # you can use like this after set image dir.


# Url mode needs to input image URL.
# Only URL tail ".bmp", ".jpg" or ".png" can analyze.
url <- "http://www.ess.ic.kanagawa-it.ac.jp/std_img/colorimage/Mandrill.jpg"
hsbhist(input=url, mode="url", output="Mandrill")


# If you have an image folder in your PC, easily analyze all images by using folder mode.
# Althogh the type of these images are limited ".bmp", ".jpg" or ".png", three type files in a folder can analyze by one command.
# Histogram is provided by a pdf file.
hsbhist(input=setwd(system.file("extdata", package="imhistR")), mode="folder", output="Rlogo", endoff=TRUE)

# When you analyze your picture folder, many time may have need.
# Resize give fast drawing of histogram. Compressed method is kernel.
hsbhist(input="folder name of iphone picture", mode="folder", resize=1/4)


# Web scraping from google image search is conducted by scraping mode. Twenty images were automatically downloaded and analyzed.
# So many scraping should avoid in order to conform web manner.
# If you already scraping image by other function of this package, you should use folder mode.
# Histogram is provided by a pdf file.
url <- "url from google image search of xxx"  # This package does not provide the way to scraping other web pages
hsbhist(input=url, mode="scraping")

mokazuma/imhistR documentation built on May 23, 2019, 6:01 a.m.