img_2_arr | R Documentation |
Takes an image along with x and y values and creates an R-array which is effectively a rank-3 Tensor or a 3 slice tensor T_{m,n,p}
.
img_2_arr(source.png, x.lim, y.lim, pl = T, bgrnd = 1)
img_2_arr(source.png, x.lim, y.lim)
source.png |
Path to the PNG file |
x.lim |
The x-limits of the image. |
y.lim |
The y-limits of the image. |
pl |
Boolean bit, set to |
bgrnd |
Numeric scalar, set to 1 by default. |
For returning only the grayscale matrix without any array format explaining the independent co-ordinates, please see img_2_data.
Since T_{m,n,2}
is the X-matrix, hence every row of the matrix will be the same vector, i.e. T_{m,n,2} = T_{k,n,2}\,\,\forall m,n,k
.
Since T_{m,n,3}
is the Y-matrix, hence every column of the matrix will be the same vector, i.e. T_{m,n,3} = T_{m,k,3}\,\,\forall m,n,k
.
See image below for clearer understanding.
The returned value is a rank-3 tensor, T_{m, n, p}
, in the form of an R-array.
In T_{m,n,p}
, it should be noted that p \in \{1, 2, 3\}
.
For p = 1
, T_{m,n,1}
is the grayscale matrix.
For p = 2
, T_{m,n,2}
is the X-matrix which returns the x-value at any point on the image.
For p = 3
, T_{m,n,3}
is the Y-matrix which returns the y-value at any point on the image.
Chitran Ghosal
dat <- system.file("extdata", "STM.png", package = "StatsChitran")
tens <- img_2_arr(source.png = dat, x.lim = c(0, 6.115*10^-9), y.lim = c(0, 6.115*10^-9))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.