|
第3章 3.2.3 图像操作
出问题的函数是
blurpart <- function(img,rows,cols,q) {
lrows <- length(rows)
lcols <- length(cols)
newimg <- img
randomnoise <- matrix(nrow=lrows, ncol=lcols,runif(lrows*lcols))
newimg@grey <- (1-q) * img@grey + q * randomnoise
return(newimg)
}
前面运行了
library(pixmap)
mtrush1 <- read.pnm("1.pgm")
mtrush3 <- blurpart(mtrush1,42:60,14:38,0.65)
运行后出现
Error in (1 - q) * img@grey + q * randomnoise : non-conformable arrays
什么回事,新手求救!
|
|