Aperture/mask for multiple images

Hi all

I’m trying to display two jpegs simultaneously side-by-side (an online dot-probe experiment).
However, I’d like to restrict the size of the image, so that it is viewed through a mask.
I understand that the textured mask option doesn’t worl on psychoJS, only when I run it locally. So I tried to use an aperture insted, but then I can only see one of the images (since the aperture blocks off everything else, I only see the image under the last aperture to load).
Has anyone thought of a clever way around this issue?

Thanks!!

Please could you show a screenshot of what you would like it to look like? Would framing polygons work?


The left-hand image is what I want, the one on the right is what the image looks like

I’m not sure what a framing polygon is but it sounds correct… How do I make one?

Try the following code in Begin Experiment

vertices = []
ovalY = .15 # vertical radius
ovalX = .2 # horizontal radius
rectY = .2 # vertical outer boundary
rectX = .4 # horizontal outer boundary
nPoints = 72 # oval resolution
for Idx in range(nPoints+1):
     vertices.append([ovalX*cos(2*pi*Idx/nPoints),ovalY*sin(2*pi*Idx/nPoints)])
vertices.append([rectX,rectY])
vertices.append([rectX,-rectY])
vertices.append([-rectX,-rectY])
vertices.append([-rectX,rectY])
vertices.append([rectX,rectY])
vertices.append([ovalX,0])

Then set up a custom polygon with vertices equal to vertices (or create a polygon in code) in the same colour as your background

Alternatively

Thanks for the tip!

Unforntunately there’s something differnt about how PsychoJS measures coordinates I guess… because after tailoring the shape sizes to fit properly on my local system it looks great, but when I upload to pavlovia and run online, the polygon is
a) way too large
b) diagonal (diamond shaped rather than rectangular)
c) doesn’t have a circular hole n the middle

see the two images for the local vs online versions


The size difference may be due to a change in units (my code assumed height units). However, the diamond issue I think is related to this.

I’ve therefore created the polygon in code. However, this caused another issue with ending up behind the image. I’ve solved this by jittering the opacity of the polygon. However, the image is still fully visible for one frame.

So regarding the units, how do I verify them? If I’m writing the experiment on psychoPy, but want to test it online, I have to change parameters in the builder view and then look what happens in the browser through pavolvia?

and regarding the second issue, so basically you’re telling me that I can’t make it work unless I’m willing to (a) “sacrifice” the first frame and (b) jitter the opacity between trials (which will also change the contrast/ visibility f the underlying image)?

Units – I’m not sure what went wrong with your units. Usually I use height and it works the same offline and online.

I’ve now worked out a way to frame the image from the first frame.

The issue was that my image component was being given priority over my polygon code and it took a frame to switch that priority. The way I’ve succeeded is to create the image in a previous routine with 0 opacity. This routine could, for example, contain a fixation cross.

Then in Begin Routine of the real trial I set the opacity of the image to 1 and autodraw the image and framing polygon in that order. No “Each Frame” jittering is needed.

Yeah Ifigured out the units (they were set to “norm” instead of “height” in exp settings)

And I’ll take a look at your new polygon code bit later on and see if it works for me

Thanks a lot!!