ng_image_array_gray: Convert a matrix or data.frame of image data into a NG_image...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ng_image.R

Description

NG_image objects are needed to plot images in the tk2d device.

ng_image_array_gray imports gray scale images that are saved in a matrix structure, that is every row or column contains the pixel data of an image.

See the "alpha_letter", "digits", "faces", "frey" and "umist_faces" demos (demo(package="RnavGraph")) for examples.

Usage

1
2
3
4
ng_image_array_gray(name, imageData,
                    width, height,
                    img_in_row = TRUE, invert = FALSE,
                    rotate = 0)

Arguments

name

Character string.

imageData

data.frame of matrix with image data. Image information must be stored as a gray scale value (0-255) within a single row or column.

width

Pixel width of image.

height

Pixel height of image.

img_in_row

Logical. Single image stored in a row or column in imageData.

invert

For invert=FALSE 0 = whit, for invert=TRUE 0=black.

rotate

Rotate the image: 0, 90, 180 or 270 degree.

Value

NG_image object

Author(s)

Adrian Waddell and R. Wayne oldford

See Also

navGraph, ng_image_files, ng_2d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Img <- matrix(c(0,0,0,255,255,255,
                0,0,0,255,255,255,
                0,0,0,255,255,255,
                255,255,255,0,0,0,
                255,255,255,0,0,0,
                255,255,255,0,0,0),
              byrow = TRUE, ncol=6)

ng.img <- ng_image_array_gray("Test",
                cbind(as.vector(Img),as.vector(Img)),6,6,FALSE)
ng.img

## See demos and vignette

RnavGraph documentation built on May 29, 2017, 4:18 p.m.