# \donttest{
#-------------------------------------------------------------------
# Description
#
# Take a digit image and compare visualization.
#-------------------------------------------------------------------
# load the data and select the first image
data(digit3)
img_matrix = digit3[[1]]
# extract a discrete measure
img_measure = img2measure(img_matrix, threshold=TRUE)
w <- img_measure$weight
w_norm <- w / max(w) # now runs from 0 to 1
col_scale <- gray(1 - w_norm) # 1 = white, 0 = black
# visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
image(img_matrix, xaxt="n", yaxt="n", main="Image Matrix")
plot(img_measure$support,
col = col_scale, xlab="", ylab="",
pch = 19, cex = 0.5, xaxt = "n", yaxt = "n",
main = "Extracted Discrete Measure")
par(opar)
# }
Run the code above in your browser using DataLab