Visual Detection Multiple Images Demo Experiment Run Experiment

Visual Detection Multiple Images

Jaap Murre

This experiment shows images in two conditions, e.g., hard and easy, or emotional and neutral. The file condition1.txt contains the exact names (with extension) of the images for this condition you have uploaded. The must be comma-delimited, e.g., image1_1.jpg, image1_2.jpg, etc. Similarly for condition 2. You can also upload a second mask (for condition 2) by updating the masks.txt file.

The images will be combined and shown in random order. Each image will first be shown very briefly (16.7 ms) followed by a mask. It will then be shown longer and longer (in steps of 16.7 ms, so called 'frames') until the subject recognizes it. The threshold (in frames) and description will be recorded in your data panel.

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

var image_names1 = getwords('condition1.txt');
var image_names2 = getwords('condition2.txt');
var mask_names = getwords('masks.txt');

var stimuli = image_names1.concat(image_names2); // Make one array with stimuli
stimuli = shuffle(stimuli); // Randomize the order

var i;

for (i = 0; i < stimuli.length; i++) {
    preload(stimuli[i]); // Get the images from the server to the subject's browser
}


for (i = 0; i < mask_names.length; i++) {
    preload(mask_names[i]); // ... and the masks as well
}

image.await("preloading_completed"); // Wait for all images to be ready to go

text("For each trial, press the spacebar as soon as you recognize the image.");
await(4000);
text("Each image is follow by a random mask. Don't press space on just seeing the mask.");
await(4000);
text("Only press when you have clearly recognized the image and can describe it.");
await(4000);
text("Now, get ready for the first image.");
await(4000);
text("");
await(1000);

var s; // Stimulus counter
for (s = 0; s < stimuli.length; s++) { // Run through all stimuli
    waitfor { // waitfor ... or ... is not standard JavaScript (it is Stratified JS)
        for (i = 1; i < 20; i++) { // Show repeatedly at longer intervals
            setimage(stimuli[s]);
            await(16.66 * i);
            if (image_names1.includes(stimuli[s])) {    // We are in condition 1
                setimage(mask_names[0]);
            } else {                                    // We are in condition 2
                if (mask_names.length === 1) {          // There is only one mask
                    setimage(mask_names[0]);            // ... so use that
                } else {
                    setimage(mask_names[1]);            // Else, use the other mask
                }
            }
            await(500);
            clear();
            await(1500);
        }
    } or {
        awaitkey(" ");      // Waiting for the spacebar
        log(i,"threshold_" + stimuli[s]);
        clear();
    }
    
    input("What did you see?","description_" + stimuli[s]);
    

    clear();
    await(1000);
    
    if (s === stimuli.length-1) { // last trial
        break; // Skips the following fragment and breaks out of the for-loop
    } else {
        if (s < 2) { // For the first few, repeat the instructions
            text("Now we will repeat the procedure with a different image");
            await(3000);
            text("Again: Press the spacebar as soon as you recognize the image.");
            await(4000);
        } else { // Then, simplify the instruction
            text("Get ready for the next image");
            await(3000);
            text("");
            await(1000);
        }
    }
}


text("");
await(2000);
text("Thank you for participating!");
await(3000);

image1_1.jpg

image1_2.jpg

image2_1.jpg

image2_2.jpg

mask.jpg
This experiment has no YouTube links