x=seq(0, 2*pi,0.1) y=sin(x) plot(x,y) x_i = x y_i = y x = x+rnorm(63,0,0.15) y = y+rnorm(63,0,0.15) plot(x, y) x_d = x y_d = y for(i in 5:63){ x[i] = (sum(x_d[(i-4):i] * c(1/20,1/6,1/5,1/4,1/3))) } for(i in 5:63){ y[i] = (sum(y_d[(i-4):i] * c(1/20,1/6,1/5,1/4,1/3))) } #x[1:4] = NA #y[1:4] = NA plot(x[-(1:4)],y[-(1:4)]) image = image_read(path = "~/Masterarbeit/TeX/Plots/Data/klammern60_80.jpg") kernel <- matrix(0, ncol = 3, nrow = 3) kernel[c(1,3),1] = -1 kernel[c(1,3),3] = 1 kernel[2,1] = -2 kernel[2,3] = 2 kernel kernel <- matrix(data = c(1,4,7,4,1,4,16,26,16,4,7,26,41,26,7,4,16,26,16,4,1,4,7,4,1), ncol = 5, nrow=5) kernel = kernel/273 n=11 s=4 kernel = matrix(0,nrow = n, ncol = n) for(i in 1:n){ for(j in 1:n){ kernel[i,j] = 1/(2*pi*s) * exp(-(i+j)/(2*s)) } } image_con <- image_convolve(image, (kernel)) image_con image_write(image_con, "~/Masterarbeit/TeX/Plots/Data/image_conv11.png", format="png") img <- readPNG("~/Masterarbeit/TeX/Plots/Data/image_conv11.png") out <- matrix(0, ncol = 15, nrow=20) for(j in 1:15){ for(i in 1:20){ out[i,j] = max(img[((i-1)*4 +1):((i-1)*4+4), ((j-1)*4 +1):((j-1)*4+4)]) } } writePNG(out, target = "~/Masterarbeit/TeX/Plots/Data/image_conv12.png")