The error occurs when image_import () has been called, for example
image_import(image_pliman("soybean_touch.jpg"))
Error: 'soybean_touch' not found in
.//srv/hornik/tmp/CRAN/pliman.Rcheck/pliman/tmp_images
It seems that this error comes from this check <
https://github.com/TiagoOlivoto/pliman/blob/master/R/utils_imagem.R#L92-L97>
that checks if the image name is available in the directory. Please,
see a
toy example with my data.
# Get the patch of the image
image <- image_pliman("soybean_touch.jpg")
image
[1]
"E:/Documents/R/win-library/4.0/pliman/tmp_images/soybean_touch.jpg"
# Get the directory of the image
img_dir <- file_dir(image)
[1] "E:/Documents/R/win-library/4.0/pliman/tmp_images"
# Get all files in the directory
all_files <- sapply(list.files(img_dir), file_name)
all_files
background.jpg la_back.jpg la_leaf.jpg la_leaves.JPG
"background" "la_back" "la_leaf" "la_leaves"
la_pattern.JPG la_temp.jpg objects_300dpi.jpg sev_back.jpg
"la_pattern" "la_temp" "objects_300dpi" "sev_back"
sev_healthy.jpg sev_leaf.jpg sev_leaf_nb.jpg
sev_sympt.jpg
"sev_healthy" "sev_leaf" "sev_leaf_nb" "sev_sympt"
soy_green.jpg soybean_grain.jpg soybean_touch.jpg
"soy_green" "soybean_grain" "soybean_touch"
# Get the name of the image and check if it is in the directory
img_name <- file_name(image)
img_name
[1] "soybean_touch"
if(!grepl("http", img_dir, fixed = TRUE) & !img_name %in% all_files){
stop(" '", img_name, "' not found in ", img_dir, call. = FALSE)
}
In this case, there is no error since "soybean_touch" is in
'all_files'
I have no idea how to fix this issue and why this error occurs only on
Debian and not on Windows. Any suggestion to fix the error and/or
improve
the code will be welcome!
Thanks in advance,
Tiago
[[alternative HTML version deleted]]