[solved] Easy way to use a lot of photos?
Hi,
I already posted this question a couple of days ago but I can't find the discussion anymore.
I am making an experiment which uses a lot of photos (over 2000). The way I understand it, the only way to use these photos is to drag them to the file pool, but to use them in a loop you have to enter each file name manually. I was wondering, is there a way to just direct openSesame to a folder outside of the openSesame environment and program something like 'for this loop, use random photos from this folder'? That would help me a lot.
Thanks,
Floor
Comments
I have exactly the same request

We have a set of 3500 fractals, and a lot of variation of the code.
The hard drive is quite full...
Technical issues, sorry. But we're back online now!
Yes, you can certainly read images from a folder. OpenSesame doesn't just accept files from the file pool, it also looks in the experiment folder, and accepts relative and absolute paths.
In your case, what you could do is build a list of images at the start of your experiment. Something like this:
Once you have this list (
my_image_list), you can simply take one item from the top at the beginning of every trial. Like so (in the prepare phase on aninline_script):Because you've set
imageas an experimental variable, you can log it, use it in asketchpad, etc.See? Not that hard, really.
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thank's a lot
I'll try as soon as possible
Yes, thank you! This helps a lot.
However, with each photo, there is also a correct keyboard response. Is there a way to link a correct keyboard response to a particular picture this way?
so, to clarify: can I implement something that says "if the filename ends with 3.jpg the correct keybord response is 3"?
Nevermind, I found a way which works! (after a little bit of testing).
for those who are interested:
after
exp.set('image', image)
write: if image.endswith('3.JPG'):
exp.set("correct_answer", 3)
Thanks again for your help Sebastiaan, you saved me a lot of work!