Screenshot of Kinesza squares generated with PEBL |

On the right, you can see it depicted, and it reveals some interesting things about object recognition. There is a strong perceived contour along the edges of the square, even though one doesn't really exist. So, for the next in my recurring series of PEBL posts on "famous stimuli named after people" (see also Gabor patches, Attneave Shapes, and Landolt Rings), I'll show how Kanizsa squares can be made in PEBL.

Just to start, the basic plan will be simple. I will just create a canvas, put a circle on it and draw it on the four corners, then draw a square in the same color as the background and overwrite the black circles. The basic code is below:

define KaniszaSquare(squaresize, circleradius,fg,bg)

{

#The proper size of the whole thing is depends on both

#the square and the circles

size <- squaresize + 2*circleradius

centerX <- Ceiling(size/2)+1

centerY <- Ceiling(size/2)+1

back <- MakeCanvas(size+2,size+2,bg)

circX <- [centerX+squaresize/2,centerX+squaresize/2,

centerX-squaresize/2,centerX-squaresize/2]

circY <- [centerY+squaresize/2,centerY-squaresize/2,

centerY+squaresize/2,centerY-squaresize/2]

circ <- Circle(centerX, centerY,circleRadius,fg,1)

AddObject(circ,back)

loop(i,Transpose([circX,circY]))

{

Move(circ,First(i),Second(i))

Draw(back)

}

square <- Square(centerX,centerY,squareSize,bg,1)

AddObject(square,back)

Draw(back)

RemoveObject(circ,back)

RemoveObject(square,back)

return back

}

This can be used for psychophysics studies, looking at response time or same-different judgments by varying parameters such as edge size, circle size, pacman color, etc. Because it returns a canvas, you can also add pixel noise. The function is fairly simple, but it strikes me that the same trick can be done for any arbitrary polygon. Furthermore, if you allow whether the pacman is drawn to be a parameter, you can do some pretty interesting variations, such as the study of illusury contours. (see Sekular, Gold, Murray, and Bennet, 2000).

To do this, created a generalized version of the function called KaneszaPolygon that works in the same basis, but takes a sequence of vertices instead of defining a square

KaniszaPolygon(points, circTF, circleradius,fg,bg,show)

You specify a list of x,y points as points, then specify which vertices the circles should be shown on, which should be a list of 1s and 0s the same length as the vertex list. Then the radius in pixels, of the vertex circles, colors specifying the foreground and background (typically these will be identical, but you can make them differ if you want), and the final 1/0 specifying whether the outline of the polygon should be shown. Here is what I get for three different calls using the same basic set of points:

xys <- [[10,10],[10,50],[130,60],[100,100],[150,100],

[150,20],[80,-10],[45,10]]

show <- Shuffle([1,1,1,1,1,1,1,1])

x <- KaniszaPolygon(xys,show,10,fg,bg,1)

AddObject(x,gWin)

Move(x,200,200)

x2 <- KaniszaPolygon(xys,show,10,fg,bg,0)

AddObject(x2,gWin)

Move(x2,400,200)

x3 <- KaniszaPolygon(xys,[1,1,1,1,1,0,0,1],10,fg,bg,0)

AddObject(x3,gWin)

Move(x3,600,200)

[150,20],[80,-10],[45,10]]

show <- Shuffle([1,1,1,1,1,1,1,1])

x <- KaniszaPolygon(xys,show,10,fg,bg,1)

AddObject(x,gWin)

Move(x,200,200)

x2 <- KaniszaPolygon(xys,show,10,fg,bg,0)

AddObject(x2,gWin)

Move(x2,400,200)

x3 <- KaniszaPolygon(xys,[1,1,1,1,1,0,0,1],10,fg,bg,0)

AddObject(x3,gWin)

Move(x3,600,200)

Three examples of the same polygon as a Kanisza shape. The first uses show=1, which draws the actual polygon. The second uses show=0, and the third only draws circles at a subset of the vertices. |

This lets you add make arbitrary polygons, but only show the circles at specified vertices. One application of this is to make a square with angled sides (either acute or obtuse), and use it, perhaps with pixel noise, to investigate whether you see the inferred contours. This 'square' is just a polygon with 8 vertices, but we only show the circles on the corners. The mid-edge vertices are offset toward the center by a few pixels.

Kanisza squares with slightly concave sides. |

Another example is below, in which I move one corner in or out a little bit. These create some ambiguous asymmetric figures such that if presented tachistoscopically or in noise, you may be able to detect the askew corner but not identify which one it is.

Kanisza squares with one corner moved inward or outward, creating off-kilter stimuli |

I have added the functions KaniszaSquare and KaniszaPolygon to the PEBL library, and it should be available for PEBL 0.12 sometime in 2011. The functions should work fine with version 0.11, so contact me if you want to use them earlier.

Kanizsa, G. (1955), "Margini quasi-percettivi in campi con stimolazione omogenea.",

*Rivista di Psicologia*

**49**(1): 7–30

A.B. Sekuler, J.M. Gold, R.F. Murray & P.J. Bennett (2000). Visual completion of partly occluded objects: Insights from behavioral studies

Journal of Neuro-Ophthalmology PDF