I downloaded imagefluency package to analyze my images in Rstudio. I wrote code, added images to example-images file. But code is not working. I dont even get any error message from code. Can you help me about this situation?
library(imagefluency)
# Get complexity, contrast, simplicity and self similarity values of multiple images in a given folder (all images should be loaded in the "example_images" folder)
imglist <- list("high_1.jpg", "high_2.jpg.jpg", "high_3.jpg", "high_4.jpg.jpg", "high_5.jpg.jpg", "high_6.jpg.jpg")
for (i in imglist) {
i <- img_read(system.file("example_images", i, package = "imagefluency"))
print(data.frame(img_complexity(i),img_contrast(i), mean(rgb2gray(i)), img_self_similarity(i)))
what steps did you take to place an image high_1.jpg in to the imagefluency's example_images folder ?
you probably shouldnt do this; as the example_images are what they are , and your own images shouldnt be a confusion around that. have your own folder, and make your code read the images from that.
Because, In my first trial, I added my images to example_images file.
In my second trial, I completely changed "example_images" name and wrote "high_resized". than thought that it will reach high resized document and find images.
I dont know if you need additional help or not.
Have you verified the location of your files of interest ?
once you have a known location, you would not use system.file()
you can list.files() on where you think your location is to verify what files are there.
you can do an img_read on them like
img_read(file.path(my_location,imglist[[1]]))
assuming that my_location is set to the actual path where your images are
my_location <- "yourpathgoeshere"
you can use your for loop, but first you need to establish where your images are (avoid using system.file)
Besides the issues with the folder already raised by nirgrahamuk, the code in your original post is missing a closing bracket for the loop.
Have you tried the proposed solution to your issue on github?
Assuming your images are in the folder high_resized, what does dir.exists("high_resized/") say? What is the result of file.exists("high_resized/high_1.jpg")?
If any of these commands are FALSE, then R cannot find your images (probably because you have to change your working directory first).