when manipulating images with {imager}, I subtract an image from the other, and shockedly found I can't save the image. After converting the image into data.frame, I conclude when NAN
appears, the it can't be saved. pls find the toy example.
How can I save such image?
library(imager)
im1 <- load.image("imx1.jpg")
im2 <- load.image("imx1.jpg") %>% isoblur(5)
imx <- (im1-im2)^0.5
plot(imx)
# class(imx)
#[1] "cimg""imager_array""numeric"
save.image(imx, "imxxx.jpg")
# Error in if (any(A > 1) | any(A < 0)) { :
# missing value where TRUE/FALSE needed
imxdf <- as.data.frame(imx)
#> imxdf
# x y cc value
#1 1 1 1 NaN
#2 2 1 1 NaN
#3 3 1 1 NaN
#4 4 1 1 NaN