원시데이터 수집 시스템
선정목록으로

Generation and Detection of Alignments in Gabor Patterns

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. Samy Blusseau — CMLA, ENS Cachan, France
  2. Rafael Grompone von Gioi — CMLA, ENS Cachan, France
DOI
10.5201/ipol.2016.177
저널
Image Processing On Line
발행년도
2016
발행기관
Image Processing On Line
피인용수
0
라이선스
cc-by-nc-sa
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.5201/ipol.2016.177
토픽
Color Science and Applications
OpenAlex ID
W2556532432

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

This paper presents a method to be used in psychophysical experiments to compare directly visual perception to an a contrario algorithm, on a straight patterns detection task. The method is composed of two parts. The first part consists in building a stimulus, namely an array of oriented elements, in which an alignment is present with variable salience. The second part focuses on a detection algorithm, based on the a contrario theory, which is designed to predict which alignment will be considered as the most salient in a given stimulus.

본문 99,435자

본문 펼치기
Published in Image [Processing](https://doi.org/10.5201/ipol) On Line on 2016–11–18. Submitted on 2016–04–27, accepted on 2016–11–03. ISSN 2105–1232 _⃝_ c 2016 IPOL & the authors [CC–BY–NC–SA](http://creativecommons.org/licenses/by-nc-sa/3.0/) This article is available online with supplementary materials, software, datasets and online demo at ``` https://doi.org/10.5201/ipol.2016.177 # Generation and Detection of Alignments in Gabor Patterns ### Samy Blusseau, Rafael Grompone von Gioi ``` CMLA, ENS Cachan, France ( _{_ `samy.blusseau,` `grompone` _}_ `@cmla.ens-cachan.fr` ) _Communicated_ _by_ Gregory Randall _Demo_ _edited_ _by_ Samy Blusseau Abstract This paper presents a method to be used in psychophysical experiments to compare directly visual perception to an a contrario algorithm, on a straight patterns detection task. The method is composed of two parts. The first part consists in building a stimulus, namely an array of oriented elements, in which an alignment is present with variable salience. The second part focuses on a detection algorithm, based on the a contrario theory, which is designed to predict which alignment will be considered as the most salient in a given stimulus. Source Code The source code associated to this manuscript (written in Matlab) and an online demo are available from the web page of this article <sup>1</sup> . Keywords: human and computer vision; a contrario detection # 1 Introduction Since the emergence of the field of Computer Vision [18] about fifty years ago there have been many attempts at formalizing vision theories and especially the one formulated by the Gestalt school of psychology. Its members, Wertheimer, K¨ohler, Koffka, Kanizsa among others [28, 11, 5, 19, 10], developed from the twenties to the eighties an original modus operandi, leading to the conclusion that the first steps of visual perception are based on a reduced set of geometrical grouping laws [26, 27]. These laws, also called _Gestalts_, describe the configurations in which most human observers can’t help interpreting different elements as one shape or group. Figure 1 illustrates the laws of proximity, symmetry and good continuation. Desolneux et al. [4] designed the _a contrario_ theory as one of the attempts to provide mathematical foundations to these laws. Several properties of the _a_ _contrario_ framework argue in favor of its suitability for visual perception modeling. 1 `[https://doi.org/10.5201/ipol.2016.177](https://doi.org/10.5201/ipol.2016.177)` Samy Blusseau, Rafael Grompone von Gioi, _Generation_ _and_ _Detection_ _of_ _Alignments_ _in_ _Gabor_ _Patterns_, Image Processing On Line, 6 No grouping Proximity Symmetry Good continuation Good continuation Vs Symmetry Figure 1: Illustration of some of the grouping laws defined by the Gestalt school of psychology. The left hand image, adapted from [21], shows how proximity and symmetry forces us to group dots and lines two by two. The right hand drawing is a figure from [9], which we interpret as three smooth lines because of the good continuation grouping law. The central image, adapted from [10], illustrates relationships between grouping laws when several of them occur simultaneously. In this case, in spite of the two symmetrical shapes, we can’t help seeing two asymmetrical shapes with more regular contours. First, it applies Attneave’s principle, stating that we do not perceive any structure in white noise [1]. Computer vision algorithms based on the _a_ _contrario_ theory, like for example the Line Segment Detector [7, 8], typically avoid detections in noise. This idea is also consistent with the more general _non-accidentalness_ principle, introduced by Witkin, Tenenbaum and Lowe [14, 29, 30], and of great importance in the study of perception. This principle states that spatial relations are perceptually relevant when their accidental occurrence is unlikely. Therefore, in accordance with Attneave’s statement, these meaningful spatial relations should not appear by chance in a random image of noise. Another strength of the _a_ _contrario_ theory is that it allows the design of parameterless detection algorithms. These make as few assumptions as needed to adapt _automatically_ to a large variety of inputs. Similarly, our visual system is able to perform equally well in very different conditions, without the need to re-learn, each time, priors on the world. To link the Gestaltist qualitative description of perceptual grouping laws to a mathematical model, a quantitative gap must be bridged. Human perceptual behavior has been the subject of quantitative experimentation since the times of Fechner, the founder of Psychophysics. This relatively new science investigates the relationship between the stimulus intensity and the perceived sensation [24]. Concerning visual perception, psychophysical studies have added quantitative measurements to the qualitative observations made by the Gestaltists. Among them, one finds experiments investigating the so called contour <sup>2</sup> integration phenomenon [6]. In particular, the role of the Gestaltic _good_ _con-_ _tinuation_ grouping law (Figure 1), which can be rephrased in Palmer’s words: “All else being equal, elements that can be seen as smooth continuations of each other tend to be grouped together” [22, p. 259]. In this paper, we build on a method introduced in the early 90s [6, 12] and still used in the study of good continuation [13, 20, 15, 16, 25, 23]. It consists in embedding discrete contours in a cluttered background of oriented elements, called Gabor patches, and measuring the ability of human observers to perceive such contours, as a function of their characteristics. Here, we focus on a particular case of good continuation, namely alignments of Gabor patches, like the left hand image in Figure 2. 2The word contour is used differently in computer vision and human vision science. It is commonly used in the psychophysics literature to refer to linear structures, tested as targets for visual grouping. 269 A result that is common to the previously mentioned experiments, and illustrated in Figure 2, is that the visual system is good at detecting smooth paths formed by elements that are roughly oriented like the local tangent of the contour. These studies also reported decreasing detection performance when contours were deviating from this ideal configuration. An important step towards the understanding of the mechanisms underlying these observations is the definition of a model that could _explain_ and _predict_ these results obtained experimentally. This paper describes a methodology adapted to address that issue. Figure 2: Illustration of the perception of alignments in arrays of Gabor patches. The displayed elements have the same coordinates in all three images. In the left hand image, 10 elements are aligned and have the same orientation as their line, whereas the other elements are randomly oriented. In the right hand image, all elements have random orientations, even the 10 elements that appear aligned on the left hand image. The central image only shows the coordinates of the elements, without any orientation. An alignment is perceptible only in the left hand image, where the aligned elements have the same orientation as their line. In the first part, we present an algorithm to generate stimuli suited to test the perception of alignments in different conditions. This generation algorithm complies with several requirements. As in Figure 2, in a generated stimulus an alignment should be perceptible only thanks to the orientations of the elements composing it. It should be almost impossible to see without the orientation information, like in the central image of Figure 2, or when the orientations of the aligned elements are unconstrained, like in the right hand image. Furthermore, the algorithm should allow a great variety of stimuli. In particular, we want to test the effect observed in Figure 2 with different quantities of elements per image, several numbers of aligned elements, and in intermediate orientation conditions, that is, ranging from totally constrained orientations for the aligned elements (left hand image) to completely random orientations (right hand image). In the second part, we describe a detection algorithm based on the _a contrario_ theory, designed to detect alignments in the latter stimuli. More precisely, this algorithm relies on the non-accidentalness principle to predict whether a candidate alignment is perceptually meaningful. When the target alignment is detectable for human observers, the algorithm should detect it as well. Otherwise, it should prefer another structure in the background. # 2 Generation Algorithm The algorithm first sets the coordinates of the elements in the image, and then assigns them their orientations. Whereas this last step is straightforward (see Section 2.5), the first one is more technical and is detailed in Sections 2.1- 2.4. The idea is to place randomly, in a square image, a number _N_ of elements, _n_ of which are aligned, and so that the image is filled homogeneously, without clusters and 270 large empty regions. In short, we do so by first placing _n_ elements on a line and regularly spaced by a distance _da_, and then filling the background with _N −_ _n_ random elements respecting a minimal distance _db_ from each other and from the aligned elements. ### 2.1 Distances between Points We first need to set the minimal distance between two elements, which we will also take as the minimal distance from an element to an edge of the image. Recall that we want _N_ elements to fit into the image and fill it homogeneously, avoiding clusters and large empty regions. These requirements are somehow the converse to those of the well known problem consisting in filling a domain with as many spheres as possible, given their radius _r_ . Indeed, in our case we know the number of discs to fit into the square image, and we want to set their radius in order to get the most homogeneous layout. This amounts to placing _N_ discs with equal radius _r_ in a square, without overlap but in a compact way, so that the distance between the centers of two neighboring discs, is about 2 _r_ . The most compact configuration fulfilling these requirements consists in a hexagonal lattice. As we see in Figure 3, in such an arrangement the density is _~~√~~_ <u>1</u> 2 3 _r_ <sup>2</sup> <sup>disc</sup> <sup>per</sup> <sup>surface</sup> <sup>unit.</sup> <sup>Therefore,</sup> <sup>the</sup> <sup>maximal</sup> <sup>possible</sup> radius _rhex_ ( _N, S_ ) for _N_ discs to fit in a domain of area _S_ verifies _<u>S</u>_ _hex_ <sup>2</sup> <sup>(</sup> <sup>_N, S_</sup> <sup>) =</sup> _~~√~~_ 2 3 _r_ <sup>2</sup> 3 _N_ <sup>_._</sup> (1) The distance _dhex_ ( _N, S_ ) between two adjacent disc centers is twice this radius. In our case we want to fill a square image of size _I ×_ _I_, with the additional constraint that a disc center be also _dhex_ pixels away from the image’s edge. Thus the domain is a square with side _I −_ 4 _rhex_ = _I −_ 2 _dhex_ . Replacing _S_ by ( _I_ _−_ 2 _dhex_ ( _N, I_ )) <sup>2</sup> in Equation (1), we get the following equation for _dhex_ _dhex_ ( _N, I_ ) = 2 _I−_ 2 _dhex_ ( _N,I_ ) 2 _dhex_ ( _N,I_ ) _~~√~~_ _~~√~~_ _~~√~~_ 2 3 _N_ (2) = _~~√~~_ _~~√~~_ <u>2</u> _<u>I</u>_ 3 _~~√~~_ 2 3 _<u>IN</u>_ +4 <sup>_._</sup> # 2r Figure 3: Illustration of the density of a hexagonal arrangement of discs with radius _r_ . The area of _√_ a red equilateral triangle is 3 _r_ <sup>2</sup>, and a triangle contains half a disc (each green portion represents d _√_ a red equilateral triangle is 3 _r_ <sup>2</sup>, and a triangle contains half a disc (each green portion represents one sixth of a disc, and a triangle contains three of these portions, that is 3 _×_ <sup><u>1</u></sup> 6 <sup>=</sup> <sup><u>1</u></sup> 2 <sup>disc).</sup> <sup>Thus,</sup> one sixth of a disc, and a triangle contains three of these portions, that is 3 _×_ <sup><u>1</u></sup> 6 <sup>=</sup> <sup><u>1</u></sup> 2 <sup>disc).</sup> <sup>Thus,</sup> there is _~~√~~_ <u>1</u> 2 3 _r_ <sup>2</sup> <sup>disc</sup> <sup>per</sup> <sup>unit</sup> <sup>area.</sup> 3 _r_ <sup>2</sup> <sup>disc</sup> <sup>per</sup> <sup>unit</sup> <sup>area.</sup> In order to achieve a random layout for the elements’ coordinates (and not a regular lattice) in our stimuli we need a smaller value for the minimal distance _db_ between background points. This is 271 equivalent to throw discs with smaller radius so that they can fit more loosely in the same square. Therefore, we set <sup>3</sup> _db_ ( _N, I_ ) = _<u>λ</u>_ <u>(</u> _<u>I</u>_ _~~√~~_ _<u>−</u>_ <u>2</u> _<u>d</u>_ _~~√~~_ _<u>b</u>_ <u>(</u> _<u>N,I</u>_ <u>))</u> _~~√~~_ 2 3 _N_ (3) _<u>λI</u>_ 3 _N_ +2 _λ_ <sup>_,_</sup> = _~~√~~_ _~~√~~_ _<u>λI</u>_ 3 _~~√~~_ 2 with _λ_ _<_ 2. For our stimuli, we choose _λ_ = 1 _._ 5 and _I_ = 500 pixels. Regarding the distance _da_ separating regularly the aligned points, we simply take <u>2</u> _<u>I</u>_ _da_ ( _N, I_ ) = _dhex_ ( _N, I_ ) = ~~<u>�</u>~~ _~~√~~_ _._ (4) 2 3 _N_ + 4 Indeed, whereas _db_ is a _minimal_ distance between random points, which is never achieved in practice in the stimulus generation, _da_ is the _exact_ spacing between aligned elements; thus it is necessary to choose _da_ _> db_, otherwise the aligned points would always be closer from each other than the background elements, and would therefore be easily detected by an observer from the points coordinates only. ### 2.2 Placing the Alignment In this section we describe how we build an alignment of _n_ points, regularly spaced by a distance _da_, in a square image _I_ of size _I_ _× I_ pixels, deprived of _db_ pixels wide horizontal and vertical margins (Figure 4a). First, assume we have already chosen the center of the alignment _c_ = ( _xc, yc_ ) (that is to say the center of the segment defined by the two extremity points in the alignment), and its orientation _θa_ _∈_ [0 _, π_ ). Then, noting <sup>_−→_</sup> _va_ = ( _cos_ ( _θa_ ) _, sin_ ( _θa_ )) a unitary directing vector of this segment, the target alignment is the set points _s_ 1 _, s_ 2 _, . . ., sn_ defined by    _−→_ _s_ 1 = _c −_ <sup><u>(</u></sup> <sup>_<u>n−</u>_</sup> <sup><u>1)</u></sup> 2 <sup>_<u>×da</u>_</sup> _va_ _sk_ = _s_ 1 + ( _k −_ 1) _da_ <sup>_−→_</sup> _va_ _if_ 2 _≤_ _k_ _≤_ _n._ (5) The center _c_ and the orientation _θa_ must be chosen so that the _n_ aligned points belong to the allowed image domain, that is, in the image but not in the margins. To ensure this, it is sufficient to test if the two extremity points _s_ 1 and _sn_ fall in the image. This criterion is formalized by Equation (6).    _db_ + 2 <sup><u>1</u></sup> 2 <sup><u>1</u></sup> <sup>(</sup> <sup>_n −_</sup> <sup>1)</sup> <sup>_da |sin_</sup> <sup>(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> _≤_ _yc_ _≤_ _I_ _−_ _db −_ <sup><u>1</u></sup> 2 <sup><u>1</u></sup> 2 <sup>(</sup> <sup>_n −_</sup> <sup>1)</sup> <sup>_da |cos_</sup> <sup>(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> _≤_ _xc_ _≤_ _I_ _−_ _db −_ 2 <sup><u>1</u></sup> _db_ + <sup><u>1</u></sup> 2 2 <sup><u>1</u></sup> <sup>(</sup> <sup>_n −_</sup> <sup>1)</sup> <sup>_da |cos_</sup> <sup>(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> (6) <sup><u>1</u></sup> 2 <sup>(</sup> <sup>_n −_</sup> <sup>1)</sup> <sup>_da |sin_</sup> <sup>(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|._</sup> Thus, in our algorithm, for a given number _n_ of aligned elements, we first choose randomly the orientation _θa_, and then choose randomly the center _c_ from the rectangle defined by Equation (6), if the latter is not empty. 3It may seem more intuitive to simply relax the minimal distance by setting _db_ = _λdhex_ = _λ_ _~~√~~_ _~~√~~_ <u>23</u> _<u>I</u>_ 3 _<u>IN</u>_ +4 <sup>with</sup> <sup>_λ <_</sup> <sup>1</sup> _~~√~~_ 2 instead of the result of Equation (3) with _λ_ _<_ 2, but recall that we want the minimal distance between elements to be also the minimal distance from an element to the edge of the image. When relaxing the minimal distance between elements, we also relax the size of the square. Therefore the relaxation needs to be applied to the first line of Equation (2), and not directly to its solution _dhex_ . This is what is done in Equation (3). For large values of _N_, _db_ = _~~√~~_ _~~√~~_ _<u>λ</u>_ 31 _NI_ +2 _λ_ 1 <sup>and</sup> <sup>_db_</sup> <sup>=</sup> <sup>_λ_</sup> <sup>2</sup> <sup>_dhex_</sup> <sup>=</sup> <sup>_λ_</sup> <sup>2</sup> _~~√~~_ _~~√~~_ <u>23</u> _<u>IN</u>_ +4 <sup>give</sup> <sup>_approximately_</sup> <sup>the</sup> <sup>same</sup> <sup>_db_</sup> <sup>if</sup> <sup>_λ_</sup> <sup>1</sup> <sup>= 2</sup> <sup>_λ_</sup> <sup>2.</sup> _<u>λ</u>_ <u>1</u> _<u>I</u>_ _~~√~~_ _~~√~~_ <u>2</u> _<u>I</u>_ 3 _N_ +2 _λ_ 1 <sup>and</sup> <sup>_db_</sup> <sup>=</sup> <sup>_λ_</sup> <sup>2</sup> <sup>_dhex_</sup> <sup>=</sup> <sup>_λ_</sup> <sup>2</sup> 2 3 _~~√~~_ 2 _~~√~~_ 2 3 _<u>IN</u>_ +4 <sup>give</sup> <sup>_approximately_</sup> <sup>the</sup> <sup>same</sup> <sup>_db_</sup> <sup>if</sup> <sup>_λ_</sup> <sup>1</sup> <sup>= 2</sup> <sup>_λ_</sup> <sup>2.</sup> 272 _<u>db</u>_ Y da #### θa (xc, yc) (a) (b) ## _I_ X Figure 4: (a) The authorized image region for the elements of the stimulus: a _I_ _× I_ pixels square, deprived of _db_ pixels wide horizontal and vertical margins. (b) A discrete homogeneous line-segment, composed of _n_ = 10 points, with spacing _da_, center ( _xc, yc_ ), and direction _θa_ . In the implementation of the algorithm, we will take the left hand lower corner as the origin of the coordinates. The algorithm also ensures that this rectangle is not empty by limiting the aligned elements to a maximum number _n_ max. This quantity is defined by Equation (7) as the maximum number of elements than can fit in the allowed image domain, arranged into a central and horizontal (or, equivalently, vertical) alignment with _da_ pixels as regular spacing. This constraint guarantees that an alignment composed of no more than _n_ max elements, can always fit in the center of the image, whatever its orientation _θa_ . + 1 _._ (7) _n_ max = - _<u>I</u>_ _<u>−</u>_ <u>2</u> _<u>db</u>_ _da_ ### 2.3 Placing the Background Elements Recall that we want to fill the background of _I_ with _N_ _−_ _n_ random elements respecting a minimal distance _db_ from each other and from the aligned elements. The principle of the algorithm consists in iteratively performing two main steps. The first step is to define a “forbidden region” as the union of discs with radius _rb_ and centered at the already placed points. The second step is to choose a new point randomly and uniformly from the complement of the forbidden region. In practice, the forbidden region is defined as a discrete dilation of the set of already placed points, with an approximation of a disc of radius _rb_ as structural element. To set the problem in a discrete frame, we use a binary image _I_ <sup>_′_</sup> of size _I_ <sup>_′_</sup> _× I_ <sup>_′_</sup> pixels, in which all points will have integer coordinates. Image _I_ <sup>_′_</sup> will have a different size from _I_, as will be explained in the next paragraph. The placement of the background elements is performed in this new image _I_ <sup>_′_</sup>, and then the coordinates of these new points are mapped to _I_ with the desired resolution. Mapping between _I_ and _I_ <sup>_′_</sup> . The size _I_ <sup>_′_</sup> of _I_ <sup>_′_</sup> is deduced from the choice of the resolution to which the coordinates of the final points will be set. For example, to achieve a 0 _._ 5 pixels resolution, we set _I_ <sup>_′_</sup> = 2 _I_ . More generally, for a resolution of _r_ pixels, _I_ <sup>_′_</sup> = - _<u>I</u>_ (8) _r_ 273 where _⌈·⌉_ denotes the upper integer part. Similarly, we define in Equation (9) the mapping between the coordinates ( _x, y_ ) of a point in _I_ and its coordinates ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) in _I_ <sup>_′_</sup> . Computing ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) from ( _x, y_ ) is done deterministically, as described by Equation (9). - _<u>y</u>_ _r_ _._ (9) _x_ <sup>_′_</sup> = - _<u>x</u>_ _r_ - _,_ _y_ <sup>_′_</sup> = This mapping from _I_ to _I_ <sup>_′_</sup> is used only to transform the coordinates of the aligned points prior to set the background points. After defining the coordinates of the background points in _I_ <sup>_′_</sup>, we apply an inverse mapping to get their coordinates in _I_, as described by Equation (10). This inverse mapping ensures the desired resolution but avoids to set the coordinates on the vertices of a lattice, by adding some random noise to the position of the points. Indeed, in Equation (10), _ux_ and _uy_ are sampled independently from the uniform distribution on [0 _,_ 1].        _ux_ = _rand_ ([0 _,_ 1]) _uy_ = _rand_ ([0 _,_ 1]) _x_ = ( _x_ <sup>_′_</sup> _−_ 1 + _ux_ ) _× r_ _y_ = ( _y_ <sup>_′_</sup> _−_ 1 + _uy_ ) _× r._ (10) (a) (b) (c) (d) (e) Figure 5: Illustration of the procedure to set the coordinates of the background points. Every picture represents _I_ <sup>_′_</sup> at different steps of the procedure. The white pixels represent the authorized region _A_ at each step. (a) Initialization of _I_ <sup>_′_</sup>, only the pixels along the margins are set to _false_, and _A_ is the inner white square. (b) Update of _A_ after the dilation of the set _S_ initialized with the aligned points. (c)-(e) Dilation of _S_ after definition of one, two and 50 background points. Setting the coordinates in _I_ <sup>_′_</sup> . As we said, _I_ <sup>_′_</sup> is a binary image that we use to define the coordinates of the background points. The coordinates of every new background point in _I_ <sup>_′_</sup> are chosen randomly and uniformly from the authorized region _A_, defined as the pixels of _I_ <sup>_′_</sup> that are set to the Boolean value “true”. - _._ (11) _A_ = �( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) _∈_ [1 _, I_ <sup>_′_</sup> ] <sup>2</sup> _, I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) = _true_ Therefore, _I_ <sup>_′_</sup> is initialized by setting most of its pixels to “true”. The only pixels set to false are those which are close enough to the edges, that is <sup>_′_</sup> _b_ <sup>_≤_</sup> <sup>_x′_</sup> <sup>_≤_</sup> <sup>_I_</sup> <sup>_′ −_</sup> <sup>_d′_</sup> _b_ <sup>_′_</sup> _b_ <sup>_≤_</sup> <sup>_y′_</sup> <sup>_≤_</sup> <sup>_I_</sup> <sup>_′ −_</sup> <sup>_d_</sup> _b_ <sup>_′_</sup> - _I_ _′_ ( _x′, y′_ ) = _true_ if _d_ <sup>_′_</sup> <sup>_′_</sup> _b_ <sup>and</sup> <sup>_d′_</sup> _b_ _b_ (12) _I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) = _false_ otherwise _,_ where _d_ <sup>_′_</sup> where _d_ <sup>_′_</sup> _b_ <sup>=</sup> - _<u>drb</u>_ - is the minimum distance allowed between two points and between a point and the image’s edge, in _I_ <sup>_′_</sup> . We will denote _S_ the set of already existing points. Naturally, _S_ is initialized with the aligned points defined in section 2.2 and whose coordinates are transformed according to Equation (9). Then, the definition of a new point given the existing points in _S_, is realized following two steps. 274 <sup>_′_</sup> _b_ <sup>=</sup> - _<u>db</u>_ _r_ Figure 6: Voronoi cells for a set of points. Only cells that are fully included in the image domain are taken into account. Cells are filled in gray for background points and in light red for the aligned points. The check for density cue is a statistical _t_ -test of the hypothesis that the areas of the target and background cells are samples of two normal distributions with equal means. _•_ Step 1: update _A_ . We compute _δB_ ( _S_ ), the morphological dilation of _S_ by the structural element _B_, which is a discrete disc of radius _d_ <sup>_′_</sup> _b_ <sup>(its</sup> <sup>members</sup> <sup>comprise</sup> <sup>all</sup> <sup>pixels</sup> <sup>whose</sup> <sup>centers</sup> element _B_, which is a discrete disc of radius _d_ <sup>_′_</sup> _b_ <sup>(its</sup> <sup>members</sup> <sup>comprise</sup> <sup>all</sup> <sup>pixels</sup> <sup>whose</sup> <sup>centers</sup> are no greater than _d_ <sup>_′_</sup> _b_ <sup>away</sup> <sup>from</sup> <sup>the</sup> <sup>origin).</sup> <sup>Then</sup> <sup>we</sup> <sup>update</sup> <sup>_I_</sup> <sup>_′_</sup> <sup>by</sup> <sup>setting</sup> <sup>to</sup> <sup>false</sup> <sup>all</sup> <sup>pixels</sup> are no greater than _d_ <sup>_′_</sup> _b_ <sup>away</sup> <sup>from</sup> <sup>the</sup> <sup>origin).</sup> <sup>Then</sup> <sup>we</sup> <sup>update</sup> <sup>_I_</sup> <sup>_′_</sup> <sup>by</sup> <sup>setting</sup> <sup>to</sup> <sup>false</sup> <sup>all</sup> <sup>pixels</sup> in _δB_ ( _S_ ) _∀_ ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) _∈_ _δB_ ( _S_ ) _,_ _I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) = _false._ (13) This update of _I_ <sup>_′_</sup> automatically updates the set _A_ of authorized points, according to its definition in Equation (11). _•_ Step 2: update _S_ . The new point is chosen randomly according to a uniform distribution over the set _A_ of authorized points. This new point is then added to _S_ . These two steps are repeated until _S_ reaches _N_ points or _A_ = _∅_ . Therefore, the total number of points in the stimulus might be lower than _N_ . Finally, the coordinates of the background points, that is, the points of _S_ except the alignment, are transformed following Equation (10) to fit in _I_ . For the alignment in _I_, we keep the original coordinates, as defined in Section 2.2. ### 2.4 Checking for Density Cues Following [3, 17], we check for density cues by comparing the area of the aligned points’ Voronoi cells (also called target cells) to those of the background points (also called background cells); see Figure 6. If the areas of the target cells are significantly different from those of the background cells, then we suspect that a density cue may exist in the stimulus. The set of Voronoi cells. We first compute the Voronoi diagram for the set of points. Then we discard the cells with vertices falling outside the image domain. We will call valid cells the cells which, on the contrary, have all their vertices included in the image domain. Note that among the discarded cells there might be target ones. If strictly more than 20% of the target cells are discarded, which might happen if the alignment is close to an edge, we consider that the remaining target cells are not sufficient to compute reliable statistics. In that case, the stimulus is regarded as suspicious, and might be rejected. 275 The statistical comparison between target and background cells. If at least 80% of the target cells are kept, then we compare statistically the areas of the valid target cells to those of the valid background cells. We assume that the areas of target and background cells are independent samples of two normal distributions with equal variances, and the tested hypothesis is that these two distributions have equal means. The alternative hypothesis is that one of the two means is greater than the other. The performed test is a _t_ -test. We note _A_ = _{a_ 1 _, . . ., am}_ and _B_ = _{b_ 1 _, . . ., bq}_ respectively the sets of valid Voronoi cells areas for the alignment and the background. Their sample means are respectively noted _a_ ¯ and <sup>¯</sup> _b_ . The Matlab method _ttest_ 2 computes the sample standard deviations _sa_ and _sb_, from which it deduces a unique pooled sample standard deviation _s_ (Equation (14)).          _sa_ = _sb_ = _s_ = - _m_ <u>1</u> _−_ 1 - _mi_ =1 <sup>(</sup> <sup>_ai −_</sup> <sup>_a_</sup> <sup>¯)2�1</sup> <sup>_/_</sup> <sup>2</sup> - <u>1</u> - _q_ _q−_ 1 _j_ =1 <sup>(</sup> <sup>_bj_</sup> <sup>_−_</sup> <sup>¯</sup> <sup>_b_</sup> <sup>)2�1</sup> <sup>_/_</sup> <sup>2</sup> _<u>b</u>_ _m_ + _q−_ 2 (14) - <u>(</u> _<u>m−</u>_ <u>1)</u> _<u>s</u>_ <sup>2</sup> _<u>a</u>_ <sup>2</sup> _<u>a</u>_ <sup><u>+(</u></sup> <sup>_<u>q−</u>_</sup> <sup><u>1)</u></sup> <sup>_<u>s</u>_</sup> <sup>2</sup> _<u>b</u>_ �1 _/_ 2 _._ Then the value of interest, denoted _t_, is computed according to Equation (15), and is supposed to follow a Student _t_ -distribution with _m_ + _q −_ 2 degrees of freedom, if the tested hypothesis is correct. _<u>a</u>_ <u>¯</u> _<u>−</u>_ <sup>¯</sup> _<u>b</u>_ _t_ = _._ (15) _s_ ~~<u>�</u>~~ <u>1</u> _m_ <sup>+</sup> <sup><u>1</u></sup> _q_ _q_ If the tested hypothesis holds, _t_ is likely to be close to 0. On the contrary, the greater the absolute value of _t_, the less likely samples _A_ and _B_ come from distributions with the same means. Noting _Tm_ + _q−_ 2 a random variable following a Student _t_ -distribution with _m_ + _q −_ 2 degrees of freedom, the associated _p_ -value is therefore _−|t| < Tm_ + _q−_ 2 _< |t|_ _Tm_ + _q−_ 2 _≥|t|_ _._ (16) _p_ = 1 _−_ P _|_ = 2 P The smaller _p_, the more confidently the tested hypothesis can be rejected. The user can decide the significance threshold _p_ min under which the _p_ -value should lead to reject the null hypothesis. A common practice is to set _p_ min = 0 _._ 05, but this is only a suggestion. We prefer not to impose a rejection criterion to the user. Indeed, we are aware that the exposed strategy may not be always optimal and could be adapted. Furthermore, we believe it is useful for research purposes to observe the relationship between the statistical _p_ -value and the rendered stimulus. Finally, returning the produced stimulus along with the _p_ -value is the simplest way to guarantee the algorithm ends with an output. Note that it is also possible to assume that the areas of target and background cells are independent samples of two normal distributions with possibly _different_ variances. In that case, if the tested hypothesis of equal means is correct, the computed value _t_ has an approximate Student’s t distribution with a number of degrees of freedom given by Satterthwaite’s approximation �2 _df_ = - _<u>sm</u>_ <sup>2</sup> _<u>a</u>_ <sup>+</sup> _<u>s</u>_ <sup>2</sup> _<u>b</u>_ _q_ <u>�</u> _s_ <sup>2</sup> _<u>b</u>_ _q_ <u>�2</u> + <u>1</u> _q−_ 1 <u>�2</u> _._ (17) <u>1</u> _m−_ 1 <u>�</u> _<u>s</u>_ <sup>2</sup> _<u>a</u>_ _m_ This is what was done for the stimuli described in [2]. In the latter method, to produce one stimulus, ten were generated and the one with the greatest _p_ -value was kept. In most cases, the eventual _p_ -value was greater than 0 _._ 6. 276 #### θa α -α Figure 7: Orientation of a target element, chosen randomly from a uniform distribution over [ _θa −_ _α, θa_ + _α_ ]. ### 2.5 Setting the Orientations Target orientations. The orientations of the target elements are randomly chosen from an interval centered on the main direction _θa_ of the alignment. The width of this interval is determined by an angle _α_ _∈_ [0 _,_ <sup>_<u>π</u>_</sup> 2 <sup>],</sup> <sup>called</sup> <sup>angular</sup> <sup>jitter,</sup> <sup>and</sup> <sup>which</sup> <sup>is</sup> <sup>a</sup> <sup>parameter</sup> <sup>of</sup> <sup>the</sup> <sup>algorithm.</sup> <sup>Then</sup> <sup>the</sup> orientations _θ_ 1 _, θ_ 2 _, . . ., θn_ of the _n_ target elements are independently and uniformly sampled from the interval [ _θa −_ _α, θa_ + _α_ ]. Background orientations. The orientations of the background elements are sampled independently from a uniform distribution over all possible angles. This last step completes the definition of the set _G_ = _{_ ( _xi, yi, θi_ ) _,_ 1 _≤_ _i ≤_ _N_ _}_, representing the _N_ oriented elements that will be displayed in the stimulus. Sections 2.6 and 2.7 describe how the actual stimulus is built from _G_ . ### 2.6 Building a Patch In our stimuli a patch is a small _h × h_ pixels square image showing the central part of a symmetrical Gabor function. The family of functions _Gf,θ,σ_ we use is defined by _∀_ ( _x, y_ ) _∈_ R <sup>2</sup> _,_ _Gf,θ,σ_ ( _x, y_ ) = <sup><u>1</u></sup> 2 1 + _e_ <sup>_−_</sup> <sup>_<u>x</u>_</sup> <sup>2</sup> 2 <sup><u>+</u></sup> _σ_ <sup><u>2</u></sup> <sup>_<u>y</u>_</sup> <sup>2</sup> cos �2 _πf_ ( _y_ cos _θ −_ _x_ sin _θ_ )� <sup>�</sup> _,_ (18) where _f_ is the spatial frequency, _σ_ the space constant and _θ_ the orientation of the Gabor element. For our stimuli, we set _h_ = 15 pixels, _f_ = 0 _._ 12 cycles per pixel and _σ_ = 41 _f_ <sup>pixels.</sup> <sup>These</sup> <sup>parameters,</sup> <sup>as</sup> well as the image dimensions ( _I_ = 500 pixels), were adjusted to produce visually satisfactory stimuli and were also inspired by the literature. However, other values could be used keeping in mind some practical constraints. The patch must be large enough to show the whole part of the Gabor function where it takes values different from the background; and not too large to avoid overlaps among patches. The value of _f_ controls the thickness of this central blob. The smaller _f_, the thicker the blob and the more blurry the patch looks. Finally, setting _σ_ proportionally to _f_ <sup><u>1</u></sup> <sup>allows</sup> <sup>to</sup> <sup>control</sup> the number of blobs that are visible in the patch, independently of _f_ . Increasing the coefficient of proportionality tends to let appear more cycles, and therefore more blobs, in the patch. Given the orientation _θ_ of the patch (that is, the main orientation of the central blob), the value of pixel ( _i, j_ ) in the patch is given by _g_ ( _i, j_ ) = _Gf,θ,σ_ ( _h −_ _j_ + 1 _−_ _c, i −_ _c_ ) _,_ (19) where _c_ = <sup><u>1+</u></sup> <sup>_<u>h</u>_</sup> is such that ( _c, c_ ) are the coordinates of the center of the patch (whether in Cartesian 2 or matricial form). 277 ### 2.7 Building the Final Stimulus First, the image _I_ is initialized to the medium gray value. Then for each element ( _xi, yi, θi_ ) _∈G_, a patch _gi_ with orientation _θi_ is built as described in Section 2.6. Image _I_ is actually a matrix, in which the origin of the coordinates is the upper left hand corner, and the first and second coordinates are the row and column indexes respectively. Since ( _xi, yi_ ) are intended as Cartesian coordinates in a classically oriented frame, we need to translate them into image coordinates prior to placing the patch in the image. This is why we define the central pixel of the patch and its top left hand corner as follows _x_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> _x_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> = _xi_ _yc_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = _I_ _yc_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = _I_ _−_ _yi_ _x_ <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> = _round_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 _c_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> = _round_ ( _x_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = _round_ ( _yc_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_<u>h</u>_</sup> 2 <sup>)</sup> <sup>_,_</sup> _x_ <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> = _round_ ( _x_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 <sup>)</sup> _ystart_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> = _round_ ( _yc_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 <sup>)</sup> <sup>_,_</sup> (20) where _round_ ( _x_ ) = _⌊x_ + 0 _._ 5 _⌋_ is the closest integer to _x_ ; and finally patch _gi_ is placed in the image _I_ ( _y_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>:</sup> <sup>_y_</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_h −_</sup> <sup>1</sup> <sup>_, x_</sup> <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> <sup>:</sup> <sup>_x_</sup> <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_h −_</sup> <sup>1) =</sup> <sup>_gi._</sup> (21) ### 2.8 Examples Figures 8, 9, 10 and 11 are four examples of stimuli built with the proposed algorithm. The first three examples show satisfactory stimuli in which no significant density cue was found, that is the perceptual grouping only depends on the orientations of the target elements. In Figure 11 however, the alignment is perceptible despite the maximal angular jitter affecting the target elements. The low associated _p_ -value helps as a criterion to reject this stimulus. Figure 8: Example of a stimulus with _N_ = 100, _n_ = 5 and _α_ = <sup><u>0</u></sup> <sup>_<u>.</u>_</sup> <sup><u>3</u></sup> 2 <sup>_<u>·π</u>_</sup> <sup>.</sup> <sup>The</sup> <sup>_p_</sup> <sup>-value</sup> <sup>associated</sup> <sup>to</sup> <sup>the</sup> _t_ -test is _p_ = 0 _._ 49, which means that according to the performed test there is no significant difference between the areas of the target Voronoi cells and those of the background cells. ### 2.9 Formal Description of the Algorithm The generation algorithm, noted Algorithm 1 is described in detail by its pseudo-code. 278 Figure 9: Example of a stimulus with _N_ = 200, _n_ = 7 and _α_ = <sup><u>0</u></sup> <sup>_<u>.</u>_</sup> <sup><u>5</u></sup> 2 <sup>_<u>·π</u>_</sup> <sup>.</sup> <sup>Here</sup> <sup>the</sup> <sup>associated</sup> <sup>_p_</sup> <sup>-value</sup> is _p_ = 0 _._ 54. Like in Figure 8, this _p_ -value means that according to the _t_ -test there is no significant difference between the areas of the target and background Voronoi cells. Figure 10: Example of a stimulus with _N_ = 600, _n_ = 9 and _α_ = <sup><u>0</u></sup> <sup>_<u>.</u>_</sup> <sup><u>1</u></sup> 2 <sup>_<u>·π</u>_</sup> <sup>.</sup> <sup>Here</sup> <sup>the</sup> <sup>associated</sup> <sup>_p_</sup> <sup>-value</sup> is _p_ = 0 _._ 97. Like in Figures 8 and 9, this _p_ -value means that according to the _t_ -test there is no significant difference between the areas of the target and background Voronoi cells. Figure 11: Example of a stimulus with _N_ = 100, _n_ = 9 and _α_ = <sup>_<u>π</u>_</sup> 2 <sup>.</sup> <sup>The</sup> <sup>_p_</sup> <sup>-value</sup> <sup>associated</sup> <sup>to</sup> <sup>the</sup> _t_ -test is _p_ = 0 _._ 013, which indicates, according to the common threshold _p_ min = 0 _._ 05, that there might be a significant difference between the areas of the target Voronoi cells and those of the background cells. It is indeed relatively easy to spot the alignment in the left hand image, and in the central image. 279 <u>Algorithm</u> <u>1:</u> <u>Generation</u> <u>algorithm</u> input : The total number _N_ of elements, the number _n_ of aligned points, the level of angular jitter _α_ ; _N_ _∈_ [10 _,_ 600], _n ≥_ 3, _α ∈_ [0 _,_ <sup>_<u>π</u>_</sup> 2 <sup>].</sup> output : The coordinates _P_ and orientations Θ of all elements, the indexes of the aligned elements _idxa_, the _p_ -value _p_ associated to the statistical check for density cues, the stimulus _I_ . 1 _I_ _←_ 500 _//_ _Size_ _of_ _the_ _stimulus’_ _side,_ _in_ _pixels_ 2 _h ←_ 15 _//_ _Size_ _of_ _one_ _patch’s_ _side,_ _in_ _pixels_ 3 _f_ _←_ 0 _._ 12 _//_ _Spatial_ _frequency,_ _in_ _cycles_ _per_ _pixel_ 4 _σ_ _←_ 41 _f_ <sup>_//_</sup> <sup>_Spatial_</sup> <sup>_constant,_</sup> <sup>_in_</sup> <sup>_pixels_</sup> 5 ( _P, idxa, θa_ ) _←_ `setCoordinates` ( _I, N, n_ ) 6 _actual_ _~~N~~_ _←_ # _P_ _//_ _The_ _actual_ _number_ _of_ _points_ _that_ _could_ _fit_ _in_ _the_ _image_ _-_ _usually_ _equal_ _to_ _N_ 7 _p ←_ `checkDensityCue` ( _P, I, idxa_ ) _//_ _This_ _p-value_ _is_ _not_ _used_ _further_ _in_ _the_ _algorithm._ _It_ _informs_ _the_ _user_ _about_ _the_ _quality_ _of_ _the_ _stimulus_ _(see_ _Section_ _2.4_ _and_ _the_ _pseudo-code_ _of_ `checkDensityCue` _)._ 8 Θ _←_ `setOrientations` ( _θa, α, idxa, actual_ _N_ ) 9 _I_ _←_ `buildStimulus` ( _I, h, P,_ Θ _, σ, f_ ) 10 return _P,_ Θ _, p, idxa, I_ Function setCoordinates( _I, N, nin_ ). This function, called in Algorithm 1, takes as arguments the image side _I_ in pixels, the total number _N_ of elements and the number _nin_ of aligned elements. The function returns a list _P_ of _N_ coordinates, representing the positions of the _N_ elements; the set _idxa_ of indexes of the aligned elements in _P_ ; the orientation _θa_ of the <u>alignment.</u> 1 _λ ←_ 1 _._ 5 2 _da_ _←_ _~~√~~_ _~~√~~_ <u>2</u> _<u>I</u>_ 2 3 3 _db_ _←_ _~~√~~_ _~~√~~_ _<u>λI</u>_ _~~√~~_ 2 _~~√~~_ 2 3 _N_ +4 3 _N_ +2 _λ_ 4 ( _S, θa_ ) _←_ `placeAlignment` ( _I, nin, da, db_ ) 5 _n ←_ # _S_ 6 _idxa_ _←_ (1 _, . . ., n_ ) 7 _ρ ←_ 0 _._ 5 8 _P_ _←_ `placeBackground` ( _S, N, ρ, I, db, db_ ) 9 return _P_ _,_ _idxa,_ _θa_ 280 Function placeAlignment( _I, nin, da, dmarg_ ). This function, called in _setCoordinates_, takes as arguments the image side _I_ in pixels, the number _nin_ of aligned elements, the distance _da_ between consecutive aligned elements, in pixels, and the minimal distance _dmarg_ of any element from the image’s edge, in pixels as well. If _nin_ is too big ( _> n_ max), the actual number of aligned elements will be _n_ max. The function returns a set _S_ of coordinates of the _n_ aligned elements, <u>and</u> <u>the</u> <u>direction</u> _<u>θa</u>_ <u>of</u> <u>this</u> <u>alignment.</u> 1 _θa_ _←_ 2 _π · rand_ ([0 _,_ 1]) 2 _µx_ _←_ _rand_ ([0 _,_ 1]) 3 _µy_ _←_ _rand_ ([0 _,_ 1]) 4 _n_ max _←_ - _<u>I−</u>_ <u>2</u> _ddamarg_ + 1 _//_ _Maximal_ _number_ _of_ _aligned_ _elements_ _that_ _can_ _fit_ _in_ _the_ _image_ _for_ _any_ _θa_ 5 _n ←_ min( _nin, n_ max) 6 _L ←_ ( _n −_ 1) _da_ _//_ _Length_ _of_ _the_ _alignment_ 7 _x_ <sup>min</sup> _c_ _←_ _dmarg_ + <sup>_<u>L</u>_</sup> 2 <sup>_<u>L</u>_</sup> 2 <sup>_|_</sup> <sup>cos(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> 8 _x_ <sup>max</sup> _c_ _←_ _I_ _−_ _dmarg −_ <sup>_<u>L</u>_</sup> 2 9 _yc_ <sup>min</sup> _←_ _dmarg_ + <sup>_<u>L</u>_</sup> 2 <sup>_<u>L</u>_</sup> 2 <sup>_|_</sup> <sup>cos(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> <sup>_<u>L</u>_</sup> 2 <sup>_|_</sup> <sup>sin(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> 10 _yc_ <sup>max</sup> _←_ _I_ _−_ _dmarg −_ <sup>_<u>L</u>_</sup> 2 11 _xc_ _←_ _x_ <sup>min</sup> _c_ + _µx ·_ ( _x_ <sup>max</sup> _c_ 12 _yc_ _←_ _yc_ <sup>min</sup> + _µy ·_ ( _yc_ <sup>max</sup> <sup>_<u>L</u>_</sup> 2 <sup>_|_</sup> <sup>sin(</sup> <sup>_θa_</sup> <sup>)</sup> <sup>_|_</sup> <sup>max</sup> _c_ _−_ _x_ <sup>min</sup> _c_ <sup>min</sup> _c_ ) _c_ <sup>max</sup> _−_ _yc_ <sup>min</sup> 13 <sup>_−→_</sup> _va_ _←_ ( _ccos_ ( _θa_ ) _, sin_ ( _cθa_ )) _c_ <sup>min</sup> ) 14 _L ←_ ( _n −_ 1) _× da_ 15 _s_ 1 _←_ ( _xc, yc_ ) _−_ <sup>_<u>L</u>_</sup> 2 <sup>_−→_</sup> _va_ 16 _S_ _←{s_ 1 _}_ 17 for _k_ = 2 to _n_ do 18 _sk_ _←_ _s_ 1 + ( _k −_ 1) _da_ <sup>_−→_</sup> _va_ 19 _S_ _←_ _S ∪{sk}_ 20 end 21 return _S, θa_ 281 Function placeBackground( _S, N, r, I, dmarg, d_ min). This function, called in _setCoordinates_, takes as arguments the set _S_ of coordinates of the aligned elements, the total number _N_ of elements, the spatial resolution _r_ for the coordinates of the elements, the image side _I_ in pixels, the minimal distance _dmarg_ of any element from the image’s edge in pixels, and the minimal distance _d_ min of any element from its closest neighbor. The function returns a set _P_ of _N_ <u>coordinates,</u> <u>representing</u> <u>the</u> <u>positions</u> <u>of</u> <u>the</u> _<u>N</u>_ <u>elements.</u> 1 _I_ <sup>_′_</sup> = <u>�</u> _<u>I</u>_ _r_ 2 _d_ <sup>_′_</sup> min <sup>=</sup> - _<u>d</u>_ <u>min</u> _r_ <u>�</u> 3 _d_ <sup>_′_</sup> _marg_ <sup>=</sup> <u>�</u> _<u>dmarg</u>_ _r_ - <u>1</u> 4 _S_ <sup>_′_</sup> _←_ _r_ <sup>_· S_</sup> _//_ _Initialize_ _I_ <sup>_′_</sup> _according_ _to_ _Equation_ (12) _,_ _as_ _illustrated_ _in_ _Figure_ _5(a)_ 5 _I_ <sup>_′_</sup> _←_ _false_ ( _I_ <sup>_′_</sup> _, I_ <sup>_′_</sup> ) 6 for _x_ <sup>_′_</sup> = _d_ <sup>_′_</sup> _marg_ <sup>+ 1</sup> <sup>to</sup> <sup>_I_</sup> <sup>_′ −_</sup> <sup>_d′_</sup> <sup>_′_</sup> _marg_ <sup>+ 1</sup> <sup>to</sup> <sup>_I_</sup> <sup>_′ −_</sup> <sup>_d′_</sup> 7 for _y_ <sup>_′_</sup> = _d_ <sup>_′_</sup> <sup>_′_</sup> _marg_ <sup>do</sup> 8 _I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) _←_ _true_ <sup>_′_</sup> _marg_ <sup>do</sup> 9 end 10 end _//_ _Second_ _step_ _of_ _the_ _initialization:_ _turn_ _to_ _false_ _the_ _discs_ _around_ _the_ _aligned_ _elements,_ _as_ _illustrated_ _in_ _Figure_ _5(b)_ 11 _D_ _←_ `structuralElement` ( _disk, d_ <sup>_′_</sup> min <sup>)</sup> 12 _pool ←_ _false_ ( _I_ <sup>_′_</sup> _, I_ <sup>_′_</sup> ) 13 _pool_ ( _S_ <sup>_′_</sup> ) _←_ _true//_ _Set_ _to_ _true_ _the_ _points_ _in_ _pool_ _with_ _the_ _coordinates_ _contained_ _in_ _S_ <sup>_′_</sup> 14 _pool ←_ `dilation` ( _pool, D_ ) _//_ _Dilation_ _of_ _the_ _aligned_ _elements_ 15 _I_ <sup>_′_</sup> _←I_ <sup>_′_</sup> and _¬ pool//_ _Update_ _I_ <sup>_′_</sup> _according_ _to_ _Equation_ (13) 16 _A ←{_ ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) _∈_ [1 _, I_ <sup>_′_</sup> ] <sup>2</sup> _, I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) = _true}//_ _Authorized_ _region_ _as_ _defined_ _by_ _Equation_ (11) _//_ _Start_ _the_ _loop_ _to_ _place_ _background_ _elements,_ _as_ _illustrated_ _in_ _Figure_ _5(c),_ _(d)_ _and_ _(e)_ 17 _placed ←_ # _S//_ _Initialize_ _the_ _number_ _of_ _already_ _placed_ _elements_ _to_ _the_ _number_ _of_ _aligned_ _elements_ _that_ _could_ _be_ _placed_ 18 _B_ <sup>_′_</sup> _←∅//_ _Initialize_ _the_ _set_ _of_ _discrete_ _background_ _points_ 19 while _placed < N_ _and_ _A̸_ = _∅_ do 20 _newPt ←_ _rand_ ( _A_ ) _//_ _Choose_ _randomly_ _an_ _element_ _from_ _the_ _authorized_ _region_ 21 _B_ <sup>_′_</sup> _←_ _B_ <sup>_′_</sup> _∪_ _newPt//_ _Add_ _the_ _new_ _element_ _to_ _the_ _set_ _of_ _discrete_ _background_ _points_ 22 _pool ←_ _false_ ( _I_ <sup>_′_</sup> _, I_ <sup>_′_</sup> ) 23 _pool_ ( _newPt_ ) _←_ _true_ 24 _pool ←_ `dilation` ( _pool, D_ ) _//_ _Dilation_ _of_ _the_ _placed_ _elements_ 25 _I_ <sup>_′_</sup> _←I_ <sup>_′_</sup> and _¬ pool//_ _Update_ _I_ <sup>_′_</sup> _according_ _to_ _Equation_ (13) 26 _placed ←_ _placed_ + 1 27 _A ←{_ ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) _∈_ [1 _, I_ <sup>_′_</sup> ] <sup>2</sup> _, I_ <sup>_′_</sup> ( _x_ <sup>_′_</sup> _, y_ <sup>_′_</sup> ) = _true}//_ _Authorized_ _region_ _as_ _defined_ _by_ _Equation_ (11) 28 end _//_ _Transform_ _the_ _discrete_ _coordinates_ _of_ _background_ _points_ _back_ _to_ _non-integer_ _coordinates_ 29 _B_ _←∅_ 30 for _p_ <sup>_′_</sup> _∈_ _B_ <sup>_′_</sup> do 31 _p ←_ ( _p_ <sup>_′_</sup> _−_ 1) _r_ + _r × rand_ ([0 _,_ 1] <sup>2</sup> ) 32 _B_ _←_ _B ∪_ _p_ 33 end 34 _P_ _←_ _S ∪_ _B_ 35 return _P_ 282 Function checkDensityCue( _P, I, idxa_ ). This function, called in Algorithm 1, takes as arguments a set _P_ of _N_ coordinates, representing the positions of the _N_ elements, the image side _I_ in pixels, and the list _idxa_ of indexes of the points in _P_ belonging to the alignment. The function returns a _p_ -value associated to a statistical comparison between the areas of the Voronoi cells of the aligned elements and those of the background elements. The user shall see _p_ as a criterion to decide whether to reject the stimulus or not. If _p_ is smaller than a significance threshold _p_ min (to be chosen by the user, typically _p_ min = _._ 05), the stimulus should be rejected because the difference between the two sets of areas will be considered as significant. The value _p_ = 0 means that the statistical test was not performed, and that the stimulus should be rejected no matter <u>the</u> <u>significance</u> <u>threshold</u> _<u>p</u>_ <u>min.</u> 1 _V_ _←_ `voronoi` ( _P_ ) 2 _cellsInside ←_ _false_ (# _V_ ) 3 for _i_ = 1 to # _V_ do 4 if _V_ ( _i_ ) _⊂_ [0 _, I_ ] <sup>2</sup> then 5 _cellsInside_ ( _i_ ) _←_ _true_ 6 if _i ∈_ _idxa_ then 7 _cellsAlignmentInside ←_ _cellsAlignmentInside ∪_ _i_ 8 else 9 _cellsBackgroundInside ←_ _cellsBackgroundInside ∪_ _i_ 10 end 11 end 12 end 13 if # _cellsAlignmentInside <_ 0 _._ 8 _·_ # _idxa_ then 14 _p_ = 0 15 return _p_ 16 end 17 _Sa_ _←_ `surface` ( _V_ ( _cellsAlignmentInside_ )) 18 _Sb_ _←_ `surface` ( _V_ ( _cellsBackgroundInside_ )) 19 _p ←_ `ttest` ( _Sa, Sb_ ) _//_ _t-test,_ _see_ _Section_ _2.4_ 20 return _p_ Function SetOrientations( _θa, α, idxa, N_ ). This function, called in Algorithm 1, takes as arguments the direction _θa_ of the alignment, the angular jitter _α_, the list _idxa_ of indexes in _{_ 1 _, . . ., N_ _}_ corresponding to the aligned elements, and the total number _N_ of elements. 1 _n ←_ # _idxa_ 2 Θ _←_ 2 _π · rand_ [ _N_ ] _//_ _N_ _random_ _angles_ 3 for _i_ = 1 to _N_ do 4 if _i ∈_ _idxa_ then 5 Θ ( _i_ ) _←_ _θa_ + _α ·_ (2 _· rand_ ([0 _,_ 1]) _−_ 1) 6 else 7 Θ ( _i_ ) _←_ 2 _π · rand_ ([0 _,_ 1]) 8 end 9 end 10 return Θ 283 Function buildStimulus( _I, h, P,_ Θ _, σ, f_ ). This function, called in Algorithm 1, takes as arguments the dimension _I_ of the image’s side, the dimension _h_ of a patch’s side, the list _P_ of the patches’ coordinates, the list Θ of the patches’ orientations, the space constant _σ_ and spatial frequency _f_ that determines the aspect of a patch; the function returns the stimulus itself: a _<u>I</u>_ _<u>× I</u>_ <u>pixels</u> <u>image</u> <u>representing</u> <u>the</u> <u>set</u> <u>of</u> <u>Gabor</u> <u>patches.</u> 1 _N_ _←_ # _P_ 2 _I_ _←_ 0 _._ 5 _· ones_ ( _I, I_ ) 3 for _i_ = 1 to _N_ do 4 _x_ <sup>(</sup> _c_ <sup>_i_</sup> <sup>)</sup> _←_ _Pi.x_ 5 _yc_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _←_ _I_ _−_ _Pi.y_ <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> <sup>_←_</sup> <sup>_round_</sup> <sup>(</sup> <sup>_x_</sup> _c_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_←_</sup> <sup>_round_</sup> <sup>(</sup> <sup>_y_</sup> _c_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_<u>h</u>_</sup> 2 <sup>)</sup> <sup>_<u>h</u>_</sup> 2 <sup>)</sup> 6 _x_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> 7 _y_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _c_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 _c_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>_−_</sup> <sup>_<u>h</u>_</sup> 2 8 _cy_ _←_ _ystart_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> 9 _cx_ _←_ _x_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> 2 _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_<u>h−</u>_</sup> 2 <sup><u>1</u></sup> <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_<u>h−</u>_</sup> 2 <sup><u>1</u></sup> 2 _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>to</sup> <sup>_y_</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> 10 for _k_ = _y_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>(</sup> _start_ <sup>_i_</sup> <sup>)</sup> <sup>to</sup> <sup>_x_</sup> <sup>(</sup> <sup>_i_</sup> <sup>)</sup> 11 for _l_ = _x_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_h −_</sup> <sup>1</sup> <sup>do</sup> _start_ <sup>(</sup> <sup>_i_</sup> <sup>)</sup> <sup>+</sup> <sup>_h −_</sup> <sup>1</sup> <sup>do</sup> 12 _kc_ _←_ _h −_ _k_ + 1 _−_ _cy_ 13 _lc_ _←_ _l −_ _cx_ 14 _I_ ( _k, l_ ) _←_ _Gf,θi,σ_ ( _lc, kc_ ) _//_ _Equation_ (18) 15 end 16 end 17 end 18 return _I_ # 3 Detection Algorithm The detection algorithm described in this section is based on the _a_ _contrario_ theory, which is a mathematical formulation of the non-accidentalness principle. An _a_ _contrario_ method requires two models. On the one hand, a geometric model, which is deterministic and, on the other hand, a probabilistic model. The geometric model defines an ideal structure _x_ <sup>_∗_</sup> along with a function _dx∗_ ( _·_ ) measuring a deviation from it. For example, in our case, the ideal structure is a set of aligned Gabor patches with perfectly aligned orientations. The measure of a deviation from this ideal configuration, is detailed in Section 3.1 but we can already provide a hint of it: in Figure 12 (e) for example, the smaller the angles _αi_, the closer the depicted chain to a perfect alignment. The probabilistic model, also called _a_ _contrario_ or _background_ model, is the statistical hypothesis _H_ 0 of the absence of relevant structure - the so called _null_ _hypothesis_ . It represents the most general assumption on the data. Consistently with Attneave’s principle stating that we do not perceive any structure in white noise [1], an _a_ _contrario_ model generally gives a maximal entropy to the building blocks of the percept. For example if these building blocks are oriented, their orientations must be random, independent, and uniformly distributed for each block. By Attneave’s principle the emergence of a percept in a realization of such a model should be unlikely, and in any case purely accidental. Therefore this background model is used to test the significance of an observation, as follows. Let _X_ be a random variable consistent with _H_ 0. Given an observed structure _x_ with a deviation _dx∗_ ( _x_ ) from the ideal structure, its relevance is measured by the probability P _H_ 0( _dx∗_ ( _X_ ) _≤_ 284 _dx∗_ ( _x_ )) to be at least as close to _x_ <sup>_∗_</sup> under _H_ 0. Small deviations yield small probabilities, and are thus rare events in the background model. To evaluate the non-accidentalness of an event, an _a_ _contrario_ method takes into account the whole set of observations that were necessary to come across that particular event. For example, when looking for alignments in an array of Gabor patches, we define _a_ _priori_ a family of sets of patches, that will be tested as candidates to be alignments. This is what is usually called the _family_ _of_ _tests_, noted _T_, and _NT_ denotes the number of tests in _T_ . Then, given a tested candidate _x_ that yielded the deviation _dx∗_ ( _x_ ), denote by _X_ 1 _, X_ 2 _, . . ., XNT_, the random issues to the _NT_ tests, under the background model _H_ 0. The question is now how common or, on the contrary, how surprising it would be to observe a deviation smaller than _dx∗_ ( _x_ ) among these _NT_ tests. An answer is to estimate the expected number of variables _Xi_ that verify _dx∗_ ( _Xi_ ) _≤_ _dx∗_ ( _x_ ). The _a contrario_ theory provides as an estimate a quantity called _Number_ _of_ _False_ _Alarms_ (NFA), defined as NFA( _x_ ) = _NT_ _×_ P[ _dx∗_ ( _X_ ) _≤_ _dx∗_ ( _x_ )]. In general the NFA is an upper-bound of the number of deviations to the ideal model smaller than _dx∗_ ( _x_ ) that are expected to happen by accident in a set of _NT_ random tests. In the following subsections, we detail the geometric and _a_ _contrario_ models for our study. ### 3.1 The Geometric Model For a given a tuple ( _g_ 1 _, . . ., gn_ ) of _n_ Gabor patches, we consider the variables _α_ 1 _, α_ 2 _L, α_ 2 _R, . . .,_ _α_ ( _n−_ 1) _L, α_ ( _n−_ 1) _R, αn_, as illustrated in Figure 12(e). Variable _αiL_ is the absolute angle between the orientation of Gabor patch _i_ and the line joining it to the patch _i −_ 1, while _αiR_ is the same thing changing _i −_ 1 for _i_ + 1. Since the first and last patches in the tuple have no previous and next elements respectively, we simply note _α_ 1 def= _α_ 1 _R_ and _αn_ def= _αnL_ . Then we define _ω_ 1 def= _α_ 1, _ωn_ def= _αn_ elements respectively, we simply note _α_ 1 def= _α_ 1 _R_ and _αn_ def= _αnL_ . Then we define _ω_ 1 def= _α_ 1, _ωn_ def= _αn_ and for _i_ = 2 _, . . ., n −_ 1, _ωi_ def= max( _αiL, αiR_ ); see Figure 12(f). def= _α_ 1 _R_ and _αn_ def= _αnL_ . Then we define _ω_ 1 def= _α_ 1, _ωn_ and for _i_ = 2 _, . . ., n −_ 1, _ωi_ def= max( _αiL, αiR_ ); see Figure 12(f). The ideal alignment that will be our reference structure in the present study, is such a tuple of Gabor patches for which all angles _ωi_ s are equal to 0 rads. In words, it is a set of aligned patches whose orientations are the same as their line’s orientation. Then we measure the deviation of a general tuple from an ideal alignment by its maximum angle _ω_ <sup>_∗_</sup> <sup>def</sup> = max _{ω_ 1 _, . . ., ωn}_ . ### 3.2 The A Contrario Model Now we need to define the _a_ _contrario_ model for our stimuli. Figure 13 shows three arrays of Gabor patches with _only_ _background_ _elements_ and thus no significant alignment. Formally, we model an array of _N_ Gabor patches by a set g = _{_ ( _xi, θi_ ) _}i_ =1 _...N_, where _xi_ _∈_ R <sup>2</sup> represents the coordinates of patch number _i_, and _θi_ _∈_ R its orientation. We note x def= _{x_ 1 _, . . ., xN_ _}_ and, for any three points _x, y, z_ _∈_ x, _φxyz_ is the angle between vectors _xy_ <sup>_−→_</sup> and <sup>_−→_</sup> _yz_ . Finally, the set of the 6 nearest neighbors of a point _x ∈_ x is noted _N_ 6( _x_ ) (see Figures 12 (a) and (b)). Then we define an _a_ _contrario_ array of Gabor patches as a random set G = _{_ ( _Xi,_ Θ _i_ ) _}i_ =1 _...N_ verifying two properties: 1. The random variables Θ1 _, . . .,_ Θ _N_ are independent and uniformly distributed in [0 _,_ 2 _π_ ). For any _X_ _∈_ X and _Y_ _∈N_ 6( _X_ ) the angle Φ <sup>_∗_</sup> _XY_ def= min _Z∈N_ 6( _Y_ ) _|_ Φ _XY Z|_ is uniformly distributed in [0 _,_ <sup>_<u>π</u>_</sup> 6 <sup>)</sup> <sup>(see</sup> <sup>Figure</sup> <sup>12</sup> <sup>(d)),</sup> <sup>and</sup> <sup>is</sup> <sup>independent</sup> <sup>from</sup> <sup>Φ</sup> _X_ <sup>_∗_</sup> <sup>_′_</sup> _Y_ <sup>_′_</sup> <sup>for</sup> <sup>any</sup> <sup>(</sup> <sup>_X_</sup> <sup>_′, Y_</sup> <sup>_′_</sup> <sup>)</sup> <sup>_̸_</sup> <sup>= (</sup> <sup>_X, Y_</sup> <sup>).</sup> 2. For any _X_ _∈_ X and _Y_ _∈N_ 6( _X_ ) the angle Φ <sup>_∗_</sup> _XY_ <sup>_<u>π</u>_</sup> 6 <sup>)</sup> <sup>(see</sup> <sup>Figure</sup> <sup>12</sup> <sup>(d)),</sup> <sup>and</sup> <sup>is</sup> <sup>independent</sup> <sup>from</sup> <sup>Φ</sup> _X_ <sup>_∗_</sup> <sup>_′_</sup> _Y_ <sup>_′_</sup> <sup>for</sup> <sup>any</sup> <sup>(</sup> <sup>_X_</sup> <sup>_′, Y_</sup> <sup>_′_</sup> <sup>)</sup> <sup>_̸_</sup> <sup>= (</sup> <sup>_X, Y_</sup> <sup>).</sup> Let’s clarify the relation between this definition and the background stimuli of Figure 13. Property 1 corresponds exactly to the rule we used to define the background elements’ orientations in our arrays of patches (see Section 2.5). The relevance of property 2 needs more justification. As explained in Sections 2.1 and 2.3, we built each stimulus so that _N_ elements fit in it, that two elements were not too close to each other, and that there were no empty regions in the image. The most compact 285 (a) (b) (c) z* φxy* α3R α4 ω3 ω4 ω1 x y α2L α1 α3L α2R ω2 (d) (e) (f) Figure 12: (a) On this array of 100 Gabor patches, we represent the associated graph _γ_ (the orientations of the edges were omitted). In this graph, most of the points are linked to their 6 nearest neighbors, except when a neighbor is too remote, as it often happens for elements that are close to the image border. For a point _x_ _∈_ x (circled in white in (a)), a chain ( _x, y_ ) is started for each _y_ _∈Nγ_ ( _x_ ) in (b), and expanded in (c) into the most rectilinear possible chain. Picture (c) shows the result after 3 iterations of the expansion process. (d) Given two neighbors _x_ and _y_, we look for the neighbor _z_ of _y_ that minimizes the absolute angle between <sup>_−→_</sup> _xy_ and <sup>_−→_</sup> _yz_ . (e)-(f) The variables the algorithm measures when analyzing a chain containing _n_ = 4 points. (a) (b) (c) Figure 13: Three arrays of Gabor patches containing only background elements and illustrating the _a_ _contrario_ model. way to fit discs in a given region is to lay them on a hexagonal lattice. Here we chose the minimal distance between elements in order to allow some randomness in their coordinates. The resulting stimuli look like hexagonal lattices affected by some noise, in which property 2 approximately holds (see Figure 12 (a)). As illustrated in Figure 12 (d), in such an approximately hexagonal lattice, we expect the maximal value for the angle Φ <sup>_∗_</sup> _XY_ <sup>to</sup> <sup>be</sup> <sup>roughly</sup> <sup>_<u>π</u>_</sup> 6 <sup>.</sup> <sup>Since</sup> <sup>we</sup> <sup>do</sup> <sup>not</sup> <sup>know</sup> <sup>the</sup> <sup>actual</sup> <sup>_∗_</sup> _XY_ <sup>to</sup> <sup>be</sup> <sup>roughly</sup> <sup>_<u>π</u>_</sup> 6 expect the maximal value for the angle Φ <sup>_∗_</sup> _XY_ <sup>to</sup> <sup>be</sup> <sup>roughly</sup> <sup>_<u>π</u>_</sup> 6 <sup>.</sup> <sup>Since</sup> <sup>we</sup> <sup>do</sup> <sup>not</sup> <sup>know</sup> <sup>the</sup> <sup>actual</sup> distribution of Φ <sup>_∗_</sup> _XY_ <sup>,</sup> <sup>the</sup> <sup>simplest</sup> <sup>assumption</sup> <sup>is</sup> <sup>then</sup> <sup>the</sup> <sup>uniform</sup> <sup>distribution</sup> <sup>in</sup> <sup>[0</sup> <sup>_,_</sup> <sup>_<u>π</u>_</sup> 6 <sup>),</sup> <sup>which</sup> <sup>does</sup> <sup>_∗_</sup> _XY_ <sup>,</sup> <sup>the</sup> <sup>simplest</sup> <sup>assumption</sup> <sup>is</sup> <sup>then</sup> <sup>the</sup> <sup>uniform</sup> <sup>distribution</sup> <sup>in</sup> <sup>[0</sup> <sup>_,_</sup> <sup>_<u>π</u>_</sup> 6 <sup>_<u>π</u>_</sup> 6 <sup>),</sup> <sup>which</sup> <sup>does</sup> 286 not require to set any parameter. We checked that the empirical distribution of Φ <sup>_∗_</sup> _XY_ <sup>is</sup> <sup>reasonably</sup> close to our assumption. ### 3.3 Input of the Algorithm The input of the detection algorithm is a set g = _{_ ( _xi, θi_ ) _}i_ =1 _...N_, that models a Gabor array composed of _N_ patches (see Section 3.2). ### 3.4 The Family of Tests The family of tests is defined by first building a graph _γ_ on the set x = _{x_ 1 _, . . ., xN_ _}_, and then selecting chains of adjacent edges in this graph. The graph _γ_ . The oriented graph _γ_ = ( x _,_ e ), where x is the set of vertices and e the set of edges, is defined as follows: ( _xi, xj_ ) _∈_ e if and only if _xj_ is one of the 6 nearest neighbors of _xi_ and _d_ ( _xi, xj_ ) _≤_ _d_ max, where _d_ ( _xi, xj_ ) is the Euclidean distance between the two points, and _d_ max the maximal length we accept for an edge (see next paragraph). We will denote by _Nγ_ ( _x_ ) the set of neighbors of _x_ in _γ_ ; see Figure 12 (a). Maximal edge’s length. The maximal length for an edge is based on a statistic of the distances between a point and its nearest neighbor in x . We list the _N_ distances of each point _xi_ _∈_ x to its nearest neighbor, and define _davg_ as the mean value of this list. Then we take as maximal length for an edge _d_ max def= 2 _davg_ . This is just an empirical choice to avoid too long edges in the graph. The chains to be tested. A chain ( _z_ 1 _, z_ 2 _, . . ., zn_ ) is in the family of tests _T_ if and only if the following conditions are fulfilled    _n ≥_ 3 _∀i ∈{_ 1 _, . . ., n −_ 1 _},_ ( _zi, zi_ +1) _∈_ e _∀i ∈{_ 3 _, . . ., n},_ _zi_ = min _∈Nγ_ ( _zi−_ 1) _|φzi−_ 2 _zi−_ 1 _z|,_ (22) where _φzi−_ 2 _zi−_ 1 _z_ is the angle between vectors _z_ <sup>_−−−−−→_</sup> _i−_ 2 _zi−_ 1 and <sup>_−−−→_</sup> _zi−_ 1 _z_ . In words, the chains to be tested are sequences of adjacent elements in _γ_ that minimize the angles between consecutive edges. Figure 12 (c) shows six examples of chains to be tested, each starting from the same point and composed of five elements. The number of tests is approximately _√_ _NT_ def= 6 _× N_ _×_ _N._ (23) _NT_ is actually an overestimation of the number of tests, since not all nodes in _γ_ have six neighbors, and we only test chains containing at least three elements. ### 3.5 The NFA The NFA of each chain _c_ = ( _z_ 1 _, . . ., zn_ ) of _T_ is defined as follows. Consider the variables _ω_ 1 _, . . ., ωn_, as defined in Section 3.1 and illustrated in Figures 12(e) and (f). Under the assumption that g is a realization of an _a_ _contrario_ array of Gabor patches, the orientations _ω_ 1 _, ω_ 2 _, . . ., ωn_ are samples of _n_ independent random variables Ω1 _,_ Ω2 _, . . .,_ Ω _n_ . Ω1 and Ω _n_ are uniformly distributed in [0 _,_ <sup>_<u>π</u>_</sup> 2 <sup>],</sup> 287 and a short development, presented in the Appendix, shows that Ω2 _, . . .,_ Ω _n−_ 1 have a cumulative distribution function _F_ ( _ω_ ) = P(Ω2 _≤_ _ω_ ) = _· · ·_ = P(Ω _n−_ 1 _≤_ _ω_ ), defined by <u>12</u> _π_ <sup>2</sup> <sup>_ω_</sup> <sup>2</sup> <sup>_−_</sup> _π_ <sup><u>8</u></sup> if <sup><u>5</u></sup> <sup>_<u>π</u>_</sup> _π_ <sup><u>8</u></sup> <sup>_ω_</sup> <sup>+ 2</sup> 12 _π_ <u>12</u> <sup>2</sup> <sup>_ω_</sup> <sup>2</sup> if 0 _≤_ _ω_ _<_ 12 <sup>_<u>π</u>_</sup> _F_ ( _ω_ ) = P(Ω _≤_ _ω_ ) =            _π_ <u>2</u> <sup>_ω −_</sup> 12 <sup><u>1</u></sup> if 12 _<u>π</u>_ <sup>_≤_</sup> <sup>_ω_</sup> <sup>_<_</sup> <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> (24) <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> <sup>_≤_</sup> <sup>_ω_</sup> <sup>_≤_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_._</sup> Note that for a random patch _Zi_ in a chain, the probability law of max( _αiL, αiR_ ) depends on the angle Φ <sup>_∗_</sup> _Zi−_ 1 _Zi_ <sup>.</sup> <sup>The cumulative distribution function</sup> <sup>_F_</sup> <sup>is obtained by integrating over all possible values for</sup> Note that for a random patch _Zi_ in a chain, the probability law of max( _αiL, αiR_ ) depends on the angle Φ <sup>_∗_</sup> _Zi−_ 1 _Zi_ <sup>.</sup> <sup>The cumulative distribution function</sup> <sup>_F_</sup> <sup>is obtained by integrating over all possible values for</sup> Φ <sup>_∗_</sup> _Zi−_ 1 _Zi_ <sup>,</sup> <sup>according</sup> <sup>to</sup> <sup>the</sup> <sup>law</sup> <sup>hypothesized</sup> <sup>in</sup> <sup>the</sup> <sup>_a_</sup> <sup>_contrario_</sup> <sup>model.</sup> <sup>Noting</sup> <sup>_ω∗_</sup> <sup>def=</sup> <sup>max</sup> <sup>_{ω_</sup> <sup>1</sup> <sup>_, . . ., ωn}_</sup> <sup>_∗_</sup> _Zi−_ 1 _Zi_ <sup>,</sup> <sup>according</sup> <sup>to</sup> <sup>the</sup> <sup>law</sup> <sup>hypothesized</sup> <sup>in</sup> <sup>the</sup> <sup>_a_</sup> <sup>_contrario_</sup> <sup>model.</sup> <sup>Noting</sup> <sup>_ω∗_</sup> <sup>def=</sup> <sup>max</sup> <sup>_{ω_</sup> <sup>1</sup> <sup>_, . . ., ωn}_</sup> and Ω <sup>_∗_</sup> <sup>def</sup> = max _{_ Ω1 _, . . .,_ Ω _n}_, the probability that all Ω _i_ be less than the observed _ω_ <sup>_∗_</sup> is �2 _× F_ ( _ω_ <sup>_∗_</sup> ) <sup>_n−_</sup> <sup>2</sup> _._ (25) P (Ω <sup>_∗_</sup> _≤_ _ω_ <sup>_∗_</sup> ) = - <u>2</u> _<u>ω∗</u>_ _π_ As usual in the _a_ _contrario_ theory, we get a natural definition of the NFA of chain _c_ NFA( _c_ ) def= _NT_ _×_ P (Ω <sup>_∗_</sup> _≤_ _ω_ <sup>_∗_</sup> ) = _NT_ _×_ ### 3.6 Output of the Algorithm (26) - <u>2</u> _<u>ω∗</u>_ �2 _× F_ ( _ω∗_ ) _n−_ 2 _._ _π_ The algorithm returns the lowest NFA and the chain that achieves it. When the _a_ _contrario_ theory is applied to computer vision, the common practice is to detect only structures with NFA below a certain threshold (typically, NFA = 1). Like in [2], we want to compare the detection algorithm to visual perception on an objective task, in which both the subject and the algorithm are forced to report the most salient structure in the stimulus. If we allowed the algorithm to report no detection at all, we should give the same possibility to human observers, and this would introduce more subjectivity: the subject could actually _see_ something and decide not to consider it as a significant alignment. Moreover, we are also interested in the NFA value of the target alignment, whether it is detected or not (see demo). ### 3.7 Examples of Detections In this section we present a few examples illustrating the behavior of the detection algorithm. Figures 14 and 15 are the most representative cases: the algorithm detects the target alignment when it is conspicuous (Figure 14), but does not when it is perceptually hard to distinguish the alignment from the background (Figure 15). Figure 16 and 17 show two examples where human observers perceive the target alignment whereas it is not detected by the algorithm. In Figure 16, despite the high level of orientation jitter, human subjects could detect a part of it, composed of the third, fourth and fifth elements starting from the top. The reason is probably that the position masking left a larger space around these three elements. Note that the statistical test on density cue yields a _p_ -value of 0 _._ 79, and therefore does not point out the inefficiency of the masking here. Figure 16 also shows the algorithm’s tendency to detect curved structures when no salient alignment is present. In Figure 17, the algorithm prefers a short alignment, although the target alignment seems more salient. 288 On the contrary, Figure 18 illustrates the cases where the algorithm finds the target alignment whereas the latter is not so easy to perceive for a human observer. Because it is quite long and not so affected by angular jitter the target is expected to be easy to spot. However in this stimulus, other alignment-like structures occurred by chance in a more central part of the image, which tend to draw our attention away from the target alignment. Finally, in Figure 19 we see how the algorithm sometimes detects a chain that includes the target alignment. The latter is not significant enough to be detected alone, but participates in the detection of the bigger set. In the present example the algorithm contradicts our perception, since we tend to see the target and not the longer chain. The fact that the detected structure is curved instead of a straight alignment, shows another limitation of our algorithm. We tried several strategies to constrain the curvature of the chains by including it in the computation of the NFA. In general, this did prevent to detect curves rather than alignments. However, for all the formulations we tried, this also often led to detecting target alignments that were not perceived by human observers. In other words, we have not found the appropriate trade-off between curvature and consistency within orientations. The algorithm presented here is, among the approaches we tried, the one that best matches the human data [2]. The examples presented above are meant to give an idea of the limitations of the algorithm in some particular cases. However, in general, the algorithm provides quite accurate predictions of the perception of alignments in our stimuli. For a detailed presentation of these results, we kindly refer to [2]. Target alignment Stimulus (input) Detection: NFA = 0 _._ 91 Figure 14: Example of detection in a stimulus composed of _N_ = 100 patches, with _n_ = 6 elements affected by a jitter _α_ = <u>0</u> _<u>.</u>_ 23 _<u>π</u>_ <sup>.</sup> In general the algorithm detects the target alignment when it is conspicuous. ### 3.8 Formal Description of the Algorithm The detection algorithm, noted Algorithm 2 is described in detail by its pseudo-code. 289 Target alignment Stimulus (input) Detection: NFA = 22 Figure 15: Example of detection in a stimulus composed of _N_ = 200 patches, with _n_ = 9 elements affected by a jitter _α_ = <sup>_<u>π</u>_</sup> 2 <sup>.</sup> <sup>In</sup> <sup>general</sup> <sup>the</sup> <sup>algorithm</sup> <sup>does</sup> <sup>not</sup> <sup>detect</sup> <sup>the</sup> <sup>target</sup> <sup>alignment</sup> <sup>when</sup> <sup>it</sup> <sup>is</sup> perceptually hard to distinguish from the background. Target alignment Stimulus (input) Detection: NFA = 0 _._ 017 Figure 16: Another example of detection in a stimulus composed of _N_ = 200 patches, with _n_ = 8 elements affected by a jitter _α_ = <sup>_<u>π</u>_</sup> 2 <sup>.</sup> <sup>Despite</sup> <sup>the</sup> <sup>high</sup> <sup>level</sup> <sup>of</sup> <sup>orientation</sup> <sup>jitter,</sup> <sup>it</sup> <sup>is</sup> <sup>possible</sup> <sup>for</sup> an observer to see a part of the target alignment, composed of the third, fourth and fifth elements starting from the top. The reason is probably that the position masking left a larger space around these three elements - although the statistical test on density cue yields a _p_ -value of 0 _._ 79, and therefore does not point out the inefficiency of the masking here. The present figure also shows the algorithm’s tendency to detect curved structures when no salient alignment is present. 290 Target alignment Stimulus (input) Detection: NFA = 2 _._ 0 Figure 17: Example of detection in a stimulus composed of _N_ = 600 patches, with _n_ = 6 elements affected by a jitter _α_ = <sup>_<u>π</u>_</sup> 4 <sup>.</sup> <sup>In</sup> <sup>this</sup> <sup>case</sup> <sup>the</sup> <sup>algorithm</sup> <sup>prefers</sup> <sup>a</sup> <sup>short</sup> <sup>alignment,</sup> <sup>although</sup> <sup>the</sup> <sup>target</sup> alignment seems more salient. Target alignment Stimulus (input) Detection: NFA = 0 _._ 14 Figure 18: Example of detection in a stimulus composed of _N_ = 200 patches, with _n_ = 8 elements affected by a jitter _α_ = <sup>_<u>π</u>_</sup> 4 <sup>.</sup> <sup>Because</sup> <sup>it</sup> <sup>is</sup> <sup>quite</sup> <sup>long</sup> <sup>and</sup> <sup>not</sup> <sup>so</sup> <sup>affected</sup> <sup>by</sup> <sup>angular</sup> <sup>jitter</sup> <sup>the</sup> <sup>target</sup> <sup>is</sup> expected to be easy to spot. However in this stimulus, other alignment-like structures occurred by chance closer to the image center, which tend to draw our attention away from the target alignment. Target alignment Stimulus (input) Detection: NFA = 0 _._ 21 Figure 19: Example of detection in a stimulus composed of _N_ = 100 patches, with _n_ = 4 elements affected by a jitter _α_ = <sup>_<u>π</u>_</sup> 5 <sup>.</sup> <sup>Here</sup> <sup>the</sup> <sup>algorithm</sup> <sup>detected</sup> <sup>a</sup> <sup>longer</sup> <sup>chain</sup> <sup>than</sup> <sup>the</sup> <sup>target.</sup> <sup>The</sup> <sup>NFA</sup> associated to the target alignment composed of 4 elements is NFA = 7 _._ 3. 291 <u>Algorithm</u> <u>2:</u> <u>Detection</u> <u>algorithm</u> input : _N_ points x = _{xi}i_ =1 _...N_ in R <sup>2</sup>, _N_ angles Θ = _{θi}i_ =1 _...N_ in [0 _,_ 2 _π_ ). Each angle _θi_ is supposed to be the orientation of a Gabor element placed at _xi_ . output : The smallest NFA value NFA <sup>_∗_</sup>, and the associated set of Gabor elements _{_ ( _xi, θi_ ) _, i ∈_ _C_ <sup>_∗_</sup> _}_, where _C_ <sup>_∗_</sup> is a subset of _{_ 1 _, . . ., N_ _}_ 1 _γ_ _←_ `computeGamma` ( x ) 2 NFA <sup>_∗_</sup> _←_ + _∞_ 3 _C_ <sup>_∗_</sup> _←∅_ 4 for _i_ = 1 to _N_ do _//_ _Nγ_ ( _i_ ) _is_ _the_ _set_ _of_ _indexes_ _of_ _xi’s_ _neighbors_ _in_ _γ_ 5 for _j_ _∈Nγ_ ( _i_ ) do 6 _C_ _←_ ( _i, j_ ) 7 _lastElt ←_ _j_ 8 while # _C_ _< ⌊_ _√_ _N_ _⌋_ _and_ _lastElt̸_ = _∅_ do 9 _lastElt ←_ `findNextPoint` ( x _, γ, C_ ) 10 _C_ _←_ _C ∪_ _lastElt_ 11 NFA _←_ `nfa` ( _C,_ x _,_ Θ ) 12 if NFA _<_ NFA <sup>_∗_</sup> then 13 NFA <sup>_∗_</sup> _←_ NFA 14 _C_ <sup>_∗_</sup> _←_ _C_ 15 end 16 end 17 end 18 end 19 return NFA <sup>_∗_</sup> _, {_ ( _xi, θi_ ) _, i ∈_ _C_ <sup>_∗_</sup> _}_ 292 Function computeGamma( x ). The input x = _{xi}i_ =1 _...N_ is a set of _N_ points in R <sup>2</sup>, and the function returns an adjacency matrix _γ_ such that _γ_ ( _i, j_ ) = 1 if there is an arrow from _xi_ to _xj_, and _γ_ ( _i, j_ ) = 0 otherwise. 1 _minDistances ←∅_ 2 for _i_ = 1 to _N_ do 3 _di_ _←∅_ 4 for _j_ = 1 to _N_ do 5 _di_ _←_ _di ∪_ _d_ ( _xi, xj_ ) _//_ _Euclidean_ _distance_ 6 end 7 ( _di, idxi_ ) _←_ _sort_ ( _di_ ) _//_ _sort_ _in_ _ascending_ _order;_ _idxi_ _contains_ _the_ _new_ _order_ _of_ _the_ _points_ _indexes_ 8 _minDistances ←_ _minDistances ∪_ _di_ (2) _//_ _di_ (2) _is_ _the_ _second_ _element_ _in_ _di_ 9 end 10 _davg_ = _mean_ ( _minDistances_ ) _//_ _mean_ _value_ _of_ _the_ _set_ _minDistances_ 11 _γ_ _←_ _zeros_ ( _N, N_ ) 12 for _i_ = 1 to _N_ do 13 for _j_ = 2 to 7 do 14 if _di_ ( _j_ ) _≤_ 2 _davg_ then 15 _γ_ ( _i, idxi_ ( _j_ )) = 1 16 end 17 end 18 end 19 return _γ_ ; 293 Function findNextPoint( x _, γ, c_ ). x = _{xi}i_ =1 _...N_ is a set of _N_ points in R <sup>2</sup>, _γ_ a _N ×N_ adjacency matrix representing an oriented graph on x, and _c_ an ordered list of indexes, corresponding to a chain of points of x . The function returns an index in _{_ 1 _, . . ., N_ _}_, which corresponds to the <u>point</u> <u>which</u> <u>should</u> <u>expand</u> <u>the</u> <u>current</u> <u>chain</u> _<u>c</u>_ <u>.</u> 1 _i_ 1 _←_ _last_ ( _c_ ) 2 _i_ 2 _←_ _penultimate_ ( _c_ ) 3 _p_ 1 _←_ _xi_ 1 4 _p_ 2 _←_ _xi_ 2 5 _i_ <sup>_∗_</sup> _←∅_ 6 _maxCosine ←−∞_ 7 for _i_ 3 _∈Nγ_ ( _i_ 2) do 8 _p_ 3 _←_ _xi_ 3 _−−→p_ <u>1</u> _<u>p</u>_ <u>2</u> _<u>·</u>_ <sup>_−−→_</sup> _<u>p</u>_ <u>2</u> _<u>p</u>_ <u>3</u> 9 _currentCosine ←_ _p_ 1 _p_ 2 _·p_ 2 _p_ 3 10 if _currentCosine > maxCosine_ then 9 _currentCosine ←_ 11 _maxCosine ←_ _currentCosine_ 12 _i_ <sup>_∗_</sup> _←_ _i_ 3 13 end 14 end 15 if _i_ <sup>_∗_</sup> _∈/_ _c_ then 16 _nextPoint ←_ _i_ <sup>_∗_</sup> 17 else 18 _nextPoint ←∅_ 19 end 20 return _nextPoint_ Function nfa( _C,_ x _,_ Θ ). x = _{xi}i_ =1 _...N_ is a set of _N_ points in R <sup>2</sup>, Θ = _{θi}i_ =1 _...N_ a set of _N_ angles in [0 _,_ 2 _π_ ), and _C_ = ( _i_ 1 _, i_ 2 _, . . ., in_ ) a tuple of _n_ indexes in _{_ 1 _, . . ., N_ _}_ . 1 _p_ 1 _←_ _xi_ 1 2 _p_ 2 _←_ _xi_ 2 3 _pn−_ 1 _←_ _xin−_ 1 4 _pn_ _←_ _xn_ 5 _ω_ 1 _←|_ `angularError` ( _p_ 1 _, p_ 2 _, θi_ 1) _|_ 6 _ωn_ _←|_ `angularError` ( _pn−_ 1 _, pn, θin_ ) _|_ 7 for _k_ = 2 to _n −_ 1 do 8 _p_ 1 _←_ _xik−_ 1 9 _p_ 2 _←_ _xik_ 10 _p_ 3 _←_ _xik_ +1 11 _αL_ _←|_ `angularError` ( _p_ 1 _, p_ 2 _, θik_ ) _|_ 12 _αR_ _←|_ `angularError` ( _p_ 2 _, p_ 3 _, θik_ ) _|_ 13 _ωk_ _←_ max( _αiL, αiR_ ) 14 end 15 _ω_ <sup>_∗_</sup> _←_ max _{ω_ 1 _, ω_ 2 _, . . ., ωn}_ _√_ _√_ 16 _NT_ _←_ 6 _× N_ _×_ _N_ _//_ _(Equation_ (23) _)_ - _<u>πω∗</u>_ 17 _p ←_ �2 _× F_ ( _ω∗_ ) _n−_ 2 _//_ _(Equation_ (24) _and_ (25) _)_ 2 18 _nfa ←_ _NT_ _· p_ _//_ _(eq_ _26)_ 19 return _nfa_ 294 Function angularError( _p_ 1 _, p_ 2 _, θ_ ). _p_ 1 and _p_ 2 are two points in R <sup>2</sup> whose abscissa and ordinates are noted _pi.x_ and _pi.y_ ; _θ_ is an angle in [0 _,_ 2 _π_ ). _//_ _First_ _compute_ _the_ _orientation_ _of_ _line_ ( _p_ 1 _p_ 2) _,_ _noted_ _θ_ 12 _,_ _in_ ( _−_ <sup>_<u>π</u>_</sup> 2 1 if _p_ 1 _.x̸_ = _p_ 2 _.x_ then <sup>_<u>π</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>]</sup> 2 _θ_ 12 _←_ arctan 3 else - _<u>p</u>_ <u>1</u> _<u>.y−p</u>_ <u>2</u> _<u>.y</u>_ _p_ 1 _.x−p_ 2 _.x_ 4 _θ_ 12 _←_ <sup>_<u>π</u>_</sup> 2 5 end 6 ∆ _ang_ _←_ arctan(tan( _θ_ 12 _−_ _θ_ )) _//_ _With_ _the_ _convention:_ tan( _±_ <sup>_<u>π</u>_</sup> 2 <sup>) =</sup> <sup>_±∞_</sup> <sup>_and_</sup> <sup>arctan(</sup> <sup>_±∞_</sup> <sup>) =</sup> <sup>_±_</sup> <sup>_<u>π</u>_</sup> 2 7 return ∆ _ang_ # 4 Conclusion This paper has presented a method aiming at interpreting and quantifying the perceptual grouping of aligned oriented elements in arrays of Gabor patches. The method is composed of two main algorithms: first, a generation algorithm designed to build stimuli in which perceptual grouping is almost only due to the orientations of the patches; second, a detection algorithm designed to find the target alignments only when they are conspicuous for human visual perception. This parameterless algorithm is based on the _a_ _contrario_ theory, a mathematical model of the non-accidentalness principle. These methods were applied and tested in psychophysical experiments [2], where the NFA showed strong correlation with the detectability for human subjects, and the algorithm proved to be an accurate predictor of the average subject’s behavior. Therefore, the framework presented here is a tool to test the relevance of the _a_ _contrario_ approach to perceptual tasks in image processing and computer vision. # Appendix To analyze the distribution of the random variables Ω _i_ we start by analyzing the possible values _ω_ when the chain at point _i_ has an angle between the previous (L) and next (R) element of _ϕ_, see Figure 20. Given that _ω_ is the largest of _αL_ and _αR_, for a given _ϕ_ the possible orientations for the Gabor element are classified into four sectors, in two of them _ω_ = _αL_ and in the other two _ω_ = _αR_ . Indeed, at the orientation of the bisector of the two lines _L_ and _R_, _αL_ = _αR_ . The same happens at the bisector of _R_ and the continuation of _L_ and inversely. Let us analyze the distribution in one of the sectors; the same distribution is observed in the three others and the reader can fill the details. The minimal possible value for _ω_ is <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>as can be seen</sup> three others and the reader can fill the details. The minimal possible value for _ω_ is <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>as can be seen</sup> at the orientation marked with the letter A in Figure 21. Indeed, that orientation is the bisector of line R and the continuation of line L, which form an angle _ϕ_ . As the orientation increases clockwise, the corresponding angle _ω_ increases gradually, passing the orientation marked with the letter B, where _ω_ = <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>until</sup> <sup>arriving</sup> <sup>at</sup> <sup>the</sup> <sup>orientation</sup> <sup>C,</sup> <sup>which</sup> <sup>is</sup> <sup>orthogonal</sup> <sup>to</sup> <sup>line</sup> <sup>L</sup> <sup>and</sup> <sup>gives</sup> <sup>the</sup> where _ω_ = <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>until</sup> <sup>arriving</sup> <sup>at</sup> <sup>the</sup> <sup>orientation</sup> <sup>C,</sup> <sup>which</sup> <sup>is</sup> <sup>orthogonal</sup> <sup>to</sup> <sup>line</sup> <sup>L</sup> <sup>and</sup> <sup>gives</sup> <sup>the</sup> maximal possible value _ω_ = <sup>_<u>π</u>_</sup> 2 <sup>.</sup> <sup>Then,</sup> <sup>as the orientation goes still clockwise to the orientation D, the</sup> maximal possible value _ω_ = <sup>_<u>π</u>_</sup> 2 <sup>.</sup> <sup>Then,</sup> <sup>as the orientation goes still clockwise to the orientation D, the</sup> _ω_ decreases gradually to angle <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>which</sup> <sup>is</sup> <sup>the</sup> <sup>angle</sup> <sup>of</sup> <sup>the</sup> <sup>bisector</sup> <sup>of</sup> <sup>lines</sup> <sup>L</sup> <sup>and</sup> <sup>R.</sup> _ω_ decreases gradually to angle <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>,</sup> <sup>which</sup> <sup>is</sup> <sup>the</sup> <sup>angle</sup> <sup>of</sup> <sup>the</sup> <sup>bisector</sup> <sup>of</sup> <sup>lines</sup> <sup>L</sup> <sup>and</sup> <sup>R.</sup> Since the orientation of the Gabor element is uniformly distributed, the values for _ω_ are equiprobable in [ <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>],</sup> <sup>and</sup> <sup>so</sup> <sup>are</sup> <sup>the</sup> <sup>values</sup> <sup>in</sup> <sup>[</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>].</sup> <sup>The</sup> <sup>probability</sup> <sup>density</sup> <sup>function</sup> <sup>for</sup> <sup>_ω_</sup> <sup>,</sup> <sup>given</sup> able in [ <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>],</sup> <sup>and</sup> <sup>so</sup> <sup>are</sup> <sup>the</sup> <sup>values</sup> <sup>in</sup> <sup>[</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>].</sup> <sup>The</sup> <sup>probability</sup> <sup>density</sup> <sup>function</sup> <sup>for</sup> <sup>_ω_</sup> <sup>,</sup> <sup>given</sup> a fixed _ϕ_ can therefore be written _p_ ( _ω|ϕ_ ) = _a_ 1[ <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>)(</sup> <sup>_ω_</sup> <sup>) +</sup> <sup>_b_</sup> <sup>1[</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>](</sup> <sup>_ω_</sup> <sup>).</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>)(</sup> <sup>_ω_</sup> <sup>) +</sup> <sup>_b_</sup> <sup>1[</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>](</sup> <sup>_ω_</sup> <sup>).</sup> 295 ω = α L L ω = α R ω = α R ϕ R ω = α L Figure 20: For a fixed _ϕ_, depending on the orientation of the Gabor element, the angle _ω_ = max( _αL, αR_ ) is equal to _αL_ or _αR_ . Here we represent the different cases according to the orientation of the Gabor element. A <u>ϕ</u> 2 R L ω = α L B C <u>π</u> <u>ϕ</u> D <u>π</u> 2 2 <u>π</u> <u>ϕ</u> 2 2 2 Figure 21: Analysis of the distribution of _ω_ when the Gabor element is oriented in the bottom right sector. The letters A, B, C and D mark four key orientations in the analysis. The angular values reported next to them are the corresponding values for _ω_, and not the orientation of the Gabor element. Also, the probability that _ω_ be in the first interval is equal to the probability that the Gabor element be oriented between A and B, that is _π_ <sup><u>2</u></sup> <sup>(</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_ϕ_</sup> <sup>);</sup> <sup>similarly,</sup> <sup>the</sup> <sup>probability</sup> <sup>that</sup> <sup>_ω_</sup> <sup>be</sup> <sup>in</sup> <sup>the</sup> _π_ <sup><u>2</u></sup> <sup>(</sup> <sup>_<u>π</u>_</sup> 2 element be oriented between A and B, that is _π_ <sup><u>2</u></sup> <sup>(</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_ϕ_</sup> <sup>);</sup> <sup>similarly,</sup> <sup>the</sup> <sup>probability</sup> <sup>that</sup> <sup>_ω_</sup> <sup>be</sup> <sup>in</sup> <sup>the</sup> second interval is equal to the probability that the Gabor element be oriented between B and D, that is <sup><u>2</u></sup> _π_ <sup>_<u>ϕ</u>_</sup> <sup>.</sup> <sup>This</sup> <sup>allows</sup> <sup>to</sup> <sup>deduce</sup> <sup>the</sup> <sup>values</sup> <sup>of</sup> <sup>_a_</sup> <sup>and</sup> <sup>_b_</sup> <sup>,</sup> <sup>which</sup> <sup>gives</sup> <sup>the</sup> <sup>following</sup> <sup>probability</sup> <sup>density</sup> that is <sup><u>2</u></sup> _π_ <sup>_<u>ϕ</u>_</sup> <sup>.</sup> <sup>This</sup> <sup>allows</sup> <sup>to</sup> <sup>deduce</sup> <sup>the</sup> <sup>values</sup> <sup>of</sup> <sup>_a_</sup> <sup>and</sup> <sup>_b_</sup> <sup>,</sup> <sup>which</sup> <sup>gives</sup> <sup>the</sup> <sup>following</sup> <sup>probability</sup> <sup>density</sup> function for _ω_, given a fixed _ϕ_ _p_ ( _ω|ϕ_ ) = <sup><u>2</u></sup> _π_ <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>)(</sup> <sup>_ω_</sup> <sup>) +</sup> _π_ <sup><u>4</u></sup> <sup>1[</sup> <sup>_<u>π</u>_</sup> 2 <sup><u>2</u></sup> 2 _π_ <sup>1[</sup> <sup>_<u>ϕ</u>_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_,_</sup> <sup>_<u>π</u>_</sup> 2 <sup>](</sup> <sup>_ω_</sup> <sup>)</sup> <sup>_,_</sup> (27) 296 and the corresponding cumulative distribution function is then 0 if _ω_ _<_ <sup>_<u>ϕ</u>_</sup> 2 <u>4</u> _πω_ <sup>_−_</sup> <sup>1</sup> if <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_≤_</sup> <sup>_ω_</sup> <sup>_≤_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_._</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_≤_</sup> <sup>_ω_</sup> <sup>_<_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 P(Ω _≤_ _ω|ϕ_ ) =            _π_ <u>2</u> <sup>(</sup> <sup>_ω −_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>_<u>ϕ</u>_</sup> 2 <sup>)</sup> if <sup>_<u>ϕ</u>_</sup> 2 (28) Equations (27) and (28) can be represented as a vertical slice at a given value of _ϕ_, in Figure 22 A and B respectively. We are interested in the cumulative distribution _F_ ( _ω_ ) = P(Ω _≤_ _ω_ ) which results from integrating Equation (28) with respect to _ϕ_ between 0 and <sup>_<u>π</u>_</sup> 6 <sup>.</sup> <sup>The result is divided into three cases corresponding</sup> Equation (28) with respect to _ϕ_ between 0 and <sup>_<u>π</u>_</sup> 6 <sup>.</sup> <sup>The result is divided into three cases corresponding</sup> to the three parts of the distribution as observed in Figure 22 B, for _ω_ _<_ 12 _<u>π</u>_ <sup>,</sup> <sup>for</sup> 12 _<u>π</u>_ <sup>_≤_</sup> <sup>_ω_</sup> <sup>_<_</sup> <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> <sup>,</sup> <sup>and</sup> for <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> <sup>_≤_</sup> <sup>_ω_</sup> <sup>.</sup> <sup>A</sup> <sup>short</sup> <sup>computation</sup> <sup>gives</sup> <sup>the</sup> <sup>result</sup> <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> <sup>_≤_</sup> <sup>_ω_</sup> <sup>.</sup> <sup>A</sup> <sup>short</sup> <sup>computation</sup> <sup>gives</sup> <sup>the</sup> <sup>result</sup> <u>12</u> _π_ <sup>2</sup> <sup>_ω_</sup> <sup>2</sup> <sup>_−_</sup> _π_ <sup><u>8</u></sup> if <sup><u>5</u></sup> <sup>_<u>π</u>_</sup> _π_ <sup><u>8</u></sup> <sup>_ω_</sup> <sup>+ 2</sup> 12 _π_ <u>12</u> <sup>2</sup> <sup>_ω_</sup> <sup>2</sup> if 0 _≤_ _ω_ _<_ 12 <sup>_<u>π</u>_</sup> _F_ ( _ω_ ) = P(Ω _≤_ _ω_ ) = ω <u>π2</u>            _π_ <u>2</u> <sup>_ω −_</sup> 12 <sup><u>1</u></sup> if 12 _<u>π</u>_ <sup>_≤_</sup> <sup>_ω_</sup> <sup>_<_</sup> <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> (29) <sup><u>5</u></sup> 12 <sup>_<u>π</u>_</sup> <sup>_≤_</sup> <sup>_ω_</sup> <sup>_≤_</sup> <sup>_<u>π</u>_</sup> 2 <sup>_._</sup> <u>512π</u> 12π 0 <u>π6</u> <u>ϕ</u> <u>π</u> 2 ω 0 <u>π</u> 6 <u>ϕ</u> P( < )Ωω <u>5π</u> 12 <u>π</u> 12 A B Figure 22: A: Representation of the joint distribution of _ϕ_ and _ω_, given that _ϕ_ is uniformly distributed in [0 _,_ <sup>_<u>π</u>_</sup> 6 <sup>].</sup> Three regions are defined by the lines of equation _ω_ = _<u>ϕ</u>_ 2 <sup>and</sup> <sup>_ω_</sup> <sup>=</sup> _<u>π</u>_ 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>.</sup> B: The in [0 _,_ <sup>_<u>π</u>_</sup> 6 <sup>].</sup> Three regions are defined by the lines of equation _ω_ = _<u>ϕ</u>_ 2 <sup>and</sup> <sup>_ω_</sup> <sup>=</sup> _<u>π</u>_ 2 <sup>_−_</sup> <sup>_<u>ϕ</u>_</sup> 2 <sup>.</sup> B: The corresponding cumulative distribution function. <sup>_<u>π</u>_</sup> 6 <sup>].</sup> Three regions are defined by the lines of equation _ω_ = _<u>ϕ</u>_ 2 # Acknowledgments We thank the anonymous reviewers for valuable suggestions. Work partly founded by Centre National d’Etudes Spatiales (CNES, MISS Project), European Research Council (advanced grant Twelve Labours), Office of Naval research (ONR grant N00014-14-1-0023), DGA St´er´eo project, ANR-DGA (project ANR-12-ASTR-0035), FUI (project Plein Phare) and Institut Universitaire de France. 297 # References [1] F. Attneave, _Some_ _informational_ _aspects_ _of_ _visual_ _perception._, Psychological Review, 61 (1954), pp. 183–193. `[http://dx.doi.org/10.1037/h0054663](http://dx.doi.org/10.1037/h0054663)` . [2] S. Blusseau, A. Carboni, A. Maiche, J.M. Morel, and R. Grompone von Gioi, _Measuring_ _the_ _visual_ _salience_ _of_ _alignments_ _by_ _their_ _non-accidentalness_, Vision Research, 126 (2016), pp. 192 - 206. Quantitative Approaches in Gestalt Perception. `[http://dx.doi.org/](http://dx.doi.org/10.1016/j.visres.2015.08.014)` `[10.1016/j.visres.2015.08.014](http://dx.doi.org/10.1016/j.visres.2015.08.014)` . [3] M. Demeyer and B. Machilsen, _The_ _construction_ _of_ _perceptual_ _grouping_ _displays_ _using_ _GERT._, Behavior Research Methods, online first., (2011), pp. 1–8. `[http://dx.doi.org/10.](http://dx.doi.org/10.3758/s13428-011-0167-8)` `[3758/s13428-011-0167-8](http://dx.doi.org/10.3758/s13428-011-0167-8)` . [4] A. Desolneux, L. Moisan, and J.M. Morel, _From_ _Gestalt_ _Theory_ _to_ _Image_ _Analysis,_ _a_ _Probabilistic_ _Approach_, vol. 34 of Interdisciplinary Applied Mathematics, Springer, 2008. ISBN 978-0-387-74378-3, `[http://dx.doi.org/10.1007/978-0-387-74378-3](http://dx.doi.org/10.1007/978-0-387-74378-3)` . [5] W.D. Ellis, ed., _A_ _Source_ _Book_ _of_ _Gestalt_ _Psychology_, Humanities Press, 1967 (originally 1938). ISBN 093926630X, `[http://dx.doi.org/10.1037/11496-000](http://dx.doi.org/10.1037/11496-000)` . [6] D. J. Field, A. Hayes, and R. F. Hess, _Contour_ _integration_ _by_ _the_ _human_ _visual_ _system:_ _Evidence_ _for_ _a_ _local_ _association_ _field_, Vision Research, 33 (1993), pp. 173 - 193. `[http://dx.](http://dx.doi.org/10.1016/0042-6989%0x2893%0x2990156-Q)` `[doi.org/10.1016/0042-6989(93)90156-Q](http://dx.doi.org/10.1016/0042-6989%0x2893%0x2990156-Q)` . [7] R. Grompone von Gioi, J. Jakubowicz, J.-M Morel, and G. Randall, _LSD:_ _A_ _fast_ _line_ _segment_ _detector_ _with_ _a_ _false_ _detection_ _control_, IEEE Transactions on Pattern Analysis and Machine Intelligence, 32 (2010), pp. 722–732. `[http://dx.doi.org/10.1109/TPAMI.2008.300](http://dx.doi.org/10.1109/TPAMI.2008.300)` . [8] R. Grompone von Gioi, J. Jakubowicz, J. M. Morel, and G. Randall, _LSD:_ _a_ _line_ _segment_ _detector_, Image Processing On Line, (2012). `[http://dx.doi.org/10.5201/ipol.](http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd)` `[2012.gjmr-lsd](http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd)` . [9] G. Kanizsa, _Organization_ _in_ _vision:_ _Essays_ _on_ _Gestalt_ _perception_, Praeger New York:, 1979. ISBN 978-0275903732. [10] ~~,~~ _Grammatica_ _del_ _vedere_, Il Mulino, 1980. ISBN 978-8815060907. [11] W. K¨ohler, _Gestalt_ _Psychology_, Liveright, 1947. ISBN 978-0871402189. [12] I. Kovacs and B. Julesz, _A_ _closed_ _curve_ _is_ _much_ _more_ _than_ _an_ _incomplete_ _one:_ _Effect_ _of_ _closure_ _in_ _figure-ground_ _segmentation_, Proceedings of the National Academy of Sciences, 90 (1993), pp. 7495–7497. [13] T. Ledgeway, R.F. Hess, and W. S Geisler, _Grouping_ _local_ _orientation_ _and_ _direction_ _signals_ _to_ _extract_ _spatial_ _contours:_ _Empirical_ _tests_ _of_ _association_ _field_ _models_ _of_ _contour_ _inte-_ _gration_, Vision research, 45 (2005), pp. 2511–2522. `[http://dx.doi.org/10.1016/j.visres.](http://dx.doi.org/10.1016/j.visres.2005.04.002)` `[2005.04.002](http://dx.doi.org/10.1016/j.visres.2005.04.002)` . [14] D. Lowe, _Perceptual_ _Organization_ _and_ _Visual_ _Recognition_, Kluwer Academic Publishers, 1985. ISBN 978-1-4612-9604-1, `[http://dx.doi.org/10.1007/978-1-4613-2551-2](http://dx.doi.org/10.1007/978-1-4613-2551-2)` . 298 [15] B. Machilsen, M. Pauwels, and J. Wagemans, _The_ _role_ _of_ _vertical_ _mirror_ _symmetry_ _in_ _visual_ _shape_ _detection_, Journal of Vision, 9 (2009), p. 11. `[http://dx.doi.org/10.1167/9.12.](http://dx.doi.org/10.1167/9.12.11)` `[11](http://dx.doi.org/10.1167/9.12.11)` . [16] B. Machilsen and J. Wagemans, _Integration_ _of_ _contour_ _and_ _surface_ _information_ _in_ _shape_ _detection_, Vision Research, 51 (2011), pp. 179–186. `[http://dx.doi.org/10.1016/j.visres.](http://dx.doi.org/10.1016/j.visres.2010.11.005)` `[2010.11.005](http://dx.doi.org/10.1016/j.visres.2010.11.005)` . [17] B. Machilsen, J. Wagemans, and M. Demeyer, _Quantifying_ _density_ _cues_ _in_ _grouping_ _displays_, Vision Research, 126 (2016), pp. 207 – 219. `[http://dx.doi.org/10.1016/j.visres.](http://dx.doi.org/10.1016/j.visres.2015.06.004)` `[2015.06.004](http://dx.doi.org/10.1016/j.visres.2015.06.004)` . [18] D. Marr, _Vision_, Freeman and co., 1982. ISBN 9780262514620. [19] W. Metzger, _Gesetze_ _des_ _Sehens_, Verlag Waldemar Kramer, 3rd ed., 1975. ISBN 3880744920. [20] G.E. Nyg˚ard, T. Van Looy, and J. Wagemans, _The_ _influence_ _of_ _orientation_ _jitter_ _and_ _motion_ _on_ _contour_ _saliency_ _and_ _object_ _identification_, Vision Research, 49 (2009), pp. 2475–2484. `[http://dx.doi.org/10.1016/j.visres.2009.08.002](http://dx.doi.org/10.1016/j.visres.2009.08.002)` . [21] S.E. Palmer, _Perceptual organization in vision_, Stevens’ handbook of experimental psychology, (2002). `[http://dx.doi.org/10.1002/0471214426.pas0105](http://dx.doi.org/10.1002/0471214426.pas0105)` . [22] S. E. Palmer, _Vision_ _Science:_ _Photons_ _to_ _Phenomenology_, The MIT Press, 1999. ISBN 9780262161831. [23] M. Sassi, M. Demeyer, and J. Wagemans, _Peripheral_ _contour_ _grouping_ _and_ _saccade_ _tar-_ _geting:_ _The_ _role_ _of_ _mirror_ _symmetry_, Symmetry, 6 (2014), pp. 1–22. `[http://dx.doi.org/10.](http://dx.doi.org/10.3390/sym6010001)` `[3390/sym6010001](http://dx.doi.org/10.3390/sym6010001)` . [24] S.S. Stevens, _Psychophysics_, Transaction Publishers, 1986. ISBN 9781412832335. [25] K. Vancleef and J. Wagemans, _Component_ _processes_ _in_ _contour_ _integration:_ _A_ _direct_ _comparison_ _between_ _snakes_ _and_ _ladders_ _in_ _a_ _detection_ _and_ _a_ _shape_ _discrimination_ _task_, Vision research, 92 (2013), pp. 39–46. `[http://dx.doi.org/10.1016/j.visres.2013.09.003](http://dx.doi.org/10.1016/j.visres.2013.09.003)` . [26] J. Wagemans, J. H. Elder, M. Kubovy, S. E. Palmer, M. A. Peterson, M. Singh, and R. von der Heydt, _A_ _century_ _of_ _Gestalt_ _psychology_ _in_ _visual_ _perception:_ _I._ _Perceptual_ _grouping_ _and_ _figure–ground_ _organization._, Psychological bulletin, 138 (2012), pp. 1172–1217. `[http://dx.doi.org/10.1037/a0029333](http://dx.doi.org/10.1037/a0029333)` . [27] J. Wagemans, J. Feldman, S. Gepshtein, R. Kimchi, J. R. Pomerantz, P. A. van der Helm, and C. van Leeuwen, _A_ _century_ _of_ _Gestalt_ _psychology_ _in_ _visual_ _perception:_ _II._ _Conceptual_ _and_ _theoretical_ _foundations._, Psychological Bulletin, 138 (2012), pp. 1218–1252. `[http://dx.doi.org/10.1037/a0029334](http://dx.doi.org/10.1037/a0029334)` . [28] M. Wertheimer, _Untersuchungen_ _zur_ _Lehre_ _von_ _der_ _Gestalt._ _II_, Psychologische Forschung, 4 (1923), pp. 301–350. An abridged translation to English is included in [5]. `[http://dx.doi.](http://dx.doi.org/10.1007/BF00410640)` `[org/10.1007/BF00410640](http://dx.doi.org/10.1007/BF00410640)` . [29] A.P. Witkin and J.M. Tenenbaum, _What_ _is_ _perceptual_ _organization_ _for?_, IJCAI-83, 2 (1983), pp. 1023–1026. `[http://dl.acm.org/citation.cfm?id=1623516.1623608](http://dl.acm.org/citation.cfm?id=1623516.1623608)` . [30] A.P. Witkin and J. M. Tenenbaum, _Human_ _and_ _Machine_ _Vision_, Academic Press, 1983, ch. On the role of structure in vision, pp. 481–543. ISBN 978-0-12-084320-6. 299

섹션 본문 117문단 · 50,637자

(제목 없음)

1This paper presents a method to be used in psychophysical experiments to compare directly visual perception to an a contrario algorithm, on a straight patterns detection task.The method is composed of two parts.The first part consists in building a stimulus, namely an array of oriented elements, in which an alignment is present with variable salience.The second part focuses on a detection algorithm, based on the a contrario theory, which is designed to predict which alignment will be considered as the most salient in a given stimulus.

Introduction

2Since the emergence of the field of Computer Vision [18] about fifty years ago there have been many attempts at formalizing vision theories and especially the one formulated by the Gestalt school of psychology.Its members, Wertheimer, Köhler, Koffka, Kanizsa among others [28,11,5,19,10], developed from the twenties to the eighties an original modus operandi, leading to the conclusion that the first steps of visual perception are based on a reduced set of geometrical grouping laws [26,27].These laws, also called Gestalts, describe the configurations in which most human observers can't help interpreting different elements as one shape or group.Figure 1 illustrates the laws of proximity, symmetry and good continuation.

3Desolneux et al. [4] designed the a contrario theory as one of the attempts to provide mathematical foundations to these laws.Several properties of the a contrario framework argue in favor of its suitability for visual perception modeling.

4First, it applies Attneave's principle, stating that we do not perceive any structure in white noise [1].Computer vision algorithms based on the a contrario theory, like for example the Line Segment Detector [7,8], typically avoid detections in noise.This idea is also consistent with the Figure 1: Illustration of some of the grouping laws defined by the Gestalt school of psychology.The left hand image, adapted from [21], shows how proximity and symmetry forces us to group dots and lines two by two.The right hand drawing is a figure from [9], which we interpret as three smooth lines because of the good continuation grouping law.The central image, adapted from [10], illustrates relationships between grouping laws when several of them occur simultaneously.In this case, in spite of the two symmetrical shapes, we can't help seeing two asymmetrical shapes with more regular contours.more general non-accidentalness principle, introduced by Witkin, Tenenbaum and Lowe [14,29,30], and of great importance in the study of perception.This principle states that spatial relations are perceptually relevant when their accidental occurrence is unlikely.Therefore, in accordance with Attneave's statement, these meaningful spatial relations should not appear by chance in a random image of noise.

5Another strength of the a contrario theory is that it allows the design of parameterless detection algorithms.These make as few assumptions as needed to adapt automatically to a large variety of inputs.Similarly, our visual system is able to perform equally well in very different conditions, without the need to re-learn, each time, priors on the world.

6To link the Gestaltist qualitative description of perceptual grouping laws to a mathematical model, a quantitative gap must be bridged.Human perceptual behavior has been the subject of quantitative experimentation since the times of Fechner, the founder of Psychophysics.This relatively new science investigates the relationship between the stimulus intensity and the perceived sensation [24].Concerning visual perception, psychophysical studies have added quantitative measurements to the qualitative observations made by the Gestaltists.Among them, one finds experiments investigating the so called contour2 integration phenomenon [6].In particular, the role of the Gestaltic good continuation grouping law (Figure 1), which can be rephrased in Palmer's words: "All else being equal, elements that can be seen as smooth continuations of each other tend to be grouped together" [22, p. 259].

7In this paper, we build on a method introduced in the early 90s [6,12] and still used in the study of good continuation [13,20,15,16,25,23].It consists in embedding discrete contours in a cluttered background of oriented elements, called Gabor patches, and measuring the ability of human observers to perceive such contours, as a function of their characteristics.Here, we focus on a particular case of good continuation, namely alignments of Gabor patches, like the left hand image in Figure 2.

8A result that is common to the previously mentioned experiments, and illustrated in Figure 2, is that the visual system is good at detecting smooth paths formed by elements that are roughly oriented like the local tangent of the contour.These studies also reported decreasing detection performance when contours were deviating from this ideal configuration.An important step towards the understanding of the mechanisms underlying these observations is the definition of a model that could explain and predict these results obtained experimentally.This paper describes a methodology adapted to address that issue.In the first part, we present an algorithm to generate stimuli suited to test the perception of alignments in different conditions.This generation algorithm complies with several requirements.As in Figure 2, in a generated stimulus an alignment should be perceptible only thanks to the orientations of the elements composing it.It should be almost impossible to see without the orientation information, like in the central image of Figure 2, or when the orientations of the aligned elements are unconstrained, like in the right hand image.Furthermore, the algorithm should allow a great variety of stimuli.In particular, we want to test the effect observed in Figure 2 with different quantities of elements per image, several numbers of aligned elements, and in intermediate orientation conditions, that is, ranging from totally constrained orientations for the aligned elements (left hand image) to completely random orientations (right hand image).

9In the second part, we describe a detection algorithm based on the a contrario theory, designed to detect alignments in the latter stimuli.More precisely, this algorithm relies on the non-accidentalness principle to predict whether a candidate alignment is perceptually meaningful.When the target alignment is detectable for human observers, the algorithm should detect it as well.Otherwise, it should prefer another structure in the background.

Generation Algorithm

10The algorithm first sets the coordinates of the elements in the image, and then assigns them their orientations.Whereas this last step is straightforward (see Section 2.5), the first one is more technical and is detailed in Sections 2.1-2.4.The idea is to place randomly, in a square image, a number N of elements, n of which are aligned, and so that the image is filled homogeneously, without clusters and large empty regions.In short, we do so by first placing n elements on a line and regularly spaced by a distance d a , and then filling the background with N − n random elements respecting a minimal distance d b from each other and from the aligned elements.

Distances between Points

11We first need to set the minimal distance between two elements, which we will also take as the minimal distance from an element to an edge of the image.Recall that we want N elements to fit into the image and fill it homogeneously, avoiding clusters and large empty regions.These requirements are somehow the converse to those of the well known problem consisting in filling a domain with as many spheres as possible, given their radius r.Indeed, in our case we know the number of discs to fit into the square image, and we want to set their radius in order to get the most homogeneous layout.This amounts to placing N discs with equal radius r in a square, without overlap but in a compact way, so that the distance between the centers of two neighboring discs, is about 2r.The most compact configuration fulfilling these requirements consists in a hexagonal lattice.As we see in Figure 3, in such an arrangement the density is 1 2 √ 3r 2 disc per surface unit.Therefore, the maximal possible radius r hex (N, S) for N discs to fit in a domain of area S verifies

12The distance d hex (N, S) between two adjacent disc centers is twice this radius.In our case we want to fill a square image of size I × I, with the additional constraint that a disc center be also d hex pixels away from the image's edge.Thus the domain is a square with side I − 4r hex = I − 2d hex .Replacing S by (I − 2d hex (N, I)) 2 in Equation ( 1), we get the following equation for d hex

13.

14(

152r

16Figure 3: Illustration of the density of a hexagonal arrangement of discs with radius r.The area of a red equilateral triangle is √ 3r 2 , and a triangle contains half a disc (each green portion represents one sixth of a disc, and a triangle contains three of these portions, that is 3 × 1 6 = 1 2 disc).Thus, there is 1 2 √ 3r 2 disc per unit area.

17In order to achieve a random layout for the elements' coordinates (and not a regular lattice) in our stimuli we need a smaller value for the minimal distance d b between background points.This is equivalent to throw discs with smaller radius so that they can fit more loosely in the same square.Therefore, we set

18with λ < 2. For our stimuli, we choose λ = 1.5 and I = 500 pixels.Regarding the distance d a separating regularly the aligned points, we simply take

19Indeed, whereas d b is a minimal distance between random points, which is never achieved in practice in the stimulus generation, d a is the exact spacing between aligned elements; thus it is necessary to choose d a > d b , otherwise the aligned points would always be closer from each other than the background elements, and would therefore be easily detected by an observer from the points coordinates only.

Placing the Alignment

20In this section we describe how we build an alignment of n points, regularly spaced by a distance d a , in a square image I of size I × I pixels, deprived of d b pixels wide horizontal and vertical margins (Figure 4a).First, assume we have already chosen the center of the alignment c = (x c , y c ) (that is to say the center of the segment defined by the two extremity points in the alignment), and its orientation θ a ∈ [0, π).Then, noting − → v a = (cos(θ a ), sin(θ a )) a unitary directing vector of this segment, the target alignment is the set points s 1 , s 2 , . . ., s n defined by

21The center c and the orientation θ a must be chosen so that the n aligned points belong to the allowed image domain, that is, in the image but not in the margins.To ensure this, it is sufficient to test if the two extremity points s 1 and s n fall in the image.This criterion is formalized by Equation (6).

22Thus, in our algorithm, for a given number n of aligned elements, we first choose randomly the orientation θ a , and then choose randomly the center c from the rectangle defined by Equation ( 6), if the latter is not empty.

23The algorithm also ensures that this rectangle is not empty by limiting the aligned elements to a maximum number n max .This quantity is defined by Equation (7) as the maximum number 3 It may seem more intuitive to simply relax the minimal distance by setting

24with λ < 1 instead of the result of Equation (3) with λ < 2, but recall that we want the minimal distance between elements to be also the minimal distance from an element to the edge of the image.When relaxing the minimal distance between elements, we also relax the size of the square.Therefore the relaxation needs to be applied to the first line of Equation (2), and not directly to its solution d hex .This is what is done in Equation (3).For large values of N ,

25and

26give approximately the same of elements than can fit in the allowed image domain, arranged into a central and horizontal (or, equivalently, vertical) alignment with d a pixels as regular spacing.This constraint guarantees that an alignment composed of no more than n max elements, can always fit in the center of the image, whatever its orientation θ a .

Placing the Background Elements

27Recall that we want to fill the background of I with N − n random elements respecting a minimal distance d b from each other and from the aligned elements.The principle of the algorithm consists in iteratively performing two main steps.The first step is to define a "forbidden region" as the union of discs with radius r b and centered at the already placed points.The second step is to choose a new point randomly and uniformly from the complement of the forbidden region.In practice, the forbidden region is defined as a discrete dilation of the set of already placed points, with an approximation of a disc of radius r b as structural element.To set the problem in a discrete frame, we use a binary image I of size I × I pixels, in which all points will have integer coordinates.Image I will have a different size from I, as will be explained in the next paragraph.The placement of the background elements is performed in this new image I , and then the coordinates of these new points are mapped to I with the desired resolution.

28Mapping between I and I .The size I of I is deduced from the choice of the resolution to which the coordinates of the final points will be set.For example, to achieve a 0.5 pixels resolution, we set I = 2I.More generally, for a resolution of r pixels,

29where • denotes the upper integer part.Similarly, we define in Equation (9) the mapping between the coordinates (x, y) of a point in I and its coordinates (x , y ) in I .Computing (x , y ) from (x, y) is done deterministically, as described by Equation ( 9).

30This mapping from I to I is used only to transform the coordinates of the aligned points prior to set the background points.After defining the coordinates of the background points in I , we apply an inverse mapping to get their coordinates in I, as described by Equation ( 10).This inverse mapping ensures the desired resolution but avoids to set the coordinates on the vertices of a lattice, by adding some random noise to the position of the points.Indeed, in Equation ( 10), u x and u y are sampled independently from the uniform distribution on [0, 1].Setting the coordinates in I .As we said, I is a binary image that we use to define the coordinates of the background points.The coordinates of every new background point in I are chosen randomly and uniformly from the authorized region A, defined as the pixels of I that are set to the Boolean value "true".

31Therefore, I is initialized by setting most of its pixels to "true".The only pixels set to false are those which are close enough to the edges, that is

32where

33is the minimum distance allowed between two points and between a point and the image's edge, in I .

34We will denote S the set of already existing points.Naturally, S is initialized with the aligned points defined in section 2.2 and whose coordinates are transformed according to Equation (9).Then, the definition of a new point given the existing points in S, is realized following two steps.• Step 1: update A. We compute δ B (S), the morphological dilation of S by the structural element B, which is a discrete disc of radius d b (its members comprise all pixels whose centers are no greater than d b away from the origin).Then we update I by setting to false all pixels in δ B (S)

35This update of I automatically updates the set A of authorized points, according to its definition in Equation ( 11).

36• Step 2: update S. The new point is chosen randomly according to a uniform distribution over the set A of authorized points.This new point is then added to S.

37These two steps are repeated until S reaches N points or A = ∅.Therefore, the total number of points in the stimulus might be lower than N .Finally, the coordinates of the background points, that is, the points of S except the alignment, are transformed following Equation (10) to fit in I.For the alignment in I, we keep the original coordinates, as defined in Section 2.2.

Checking for Density Cues

38Following [3,17], we check for density cues by comparing the area of the aligned points' Voronoi cells (also called target cells) to those of the background points (also called background cells); see Figure 6.If the areas of the target cells are significantly different from those of the background cells, then we suspect that a density cue may exist in the stimulus.

39The set of Voronoi cells.We first compute the Voronoi diagram for the set of points.Then we discard the cells with vertices falling outside the image domain.We will call valid cells the cells which, on the contrary, have all their vertices included in the image domain.Note that among the discarded cells there might be target ones.If strictly more than 20% of the target cells are discarded, which might happen if the alignment is close to an edge, we consider that the remaining target cells are not sufficient to compute reliable statistics.In that case, the stimulus is regarded as suspicious, and might be rejected.

40The statistical comparison between target and background cells.If at least 80% of the target cells are kept, then we compare statistically the areas of the valid target cells to those of the valid background cells.We assume that the areas of target and background cells are independent samples of two normal distributions with equal variances, and the tested hypothesis is that these two distributions have equal means.The alternative hypothesis is that one of the two means is greater than the other.

41The performed test is a t-test.We note A = {a 1 , . . ., a m } and B = {b 1 , . . ., b q } respectively the sets of valid Voronoi cells areas for the alignment and the background.Their sample means are respectively noted ā and b.The Matlab method ttest2 computes the sample standard deviations s a and s b , from which it deduces a unique pooled sample standard deviation s (Equation ( 14)).

42Then the value of interest, denoted t, is computed according to Equation (15), and is supposed to follow a Student t-distribution with m + q − 2 degrees of freedom, if the tested hypothesis is correct.

43If the tested hypothesis holds, t is likely to be close to 0. On the contrary, the greater the absolute value of t, the less likely samples A and B come from distributions with the same means.Noting T m+q−2 a random variable following a Student t-distribution with m + q − 2 degrees of freedom, the associated p-value is therefore

44The smaller p, the more confidently the tested hypothesis can be rejected.The user can decide the significance threshold p min under which the p-value should lead to reject the null hypothesis.A common practice is to set p min = 0.05, but this is only a suggestion.We prefer not to impose a rejection criterion to the user.Indeed, we are aware that the exposed strategy may not be always optimal and could be adapted.Furthermore, we believe it is useful for research purposes to observe the relationship between the statistical p-value and the rendered stimulus.Finally, returning the produced stimulus along with the p-value is the simplest way to guarantee the algorithm ends with an output.Note that it is also possible to assume that the areas of target and background cells are independent samples of two normal distributions with possibly different variances.In that case, if the tested hypothesis of equal means is correct, the computed value t has an approximate Student's t distribution with a number of degrees of freedom given by Satterthwaite's approximation

45This is what was done for the stimuli described in [2].In the latter method, to produce one stimulus, ten were generated and the one with the greatest p-value was kept.In most cases, the eventual p-value was greater than 0.6.

Setting the Orientations

46Target orientations.The orientations of the target elements are randomly chosen from an interval centered on the main direction θ a of the alignment.The width of this interval is determined by an angle α ∈ [0, π 2 ], called angular jitter, and which is a parameter of the algorithm.Then the orientations θ 1 , θ 2 , . . ., θ n of the n target elements are independently and uniformly sampled from the interval [θ a − α, θ a + α].

47Background orientations.The orientations of the background elements are sampled independently from a uniform distribution over all possible angles.This last step completes the definition of the set G = {(x i , y i , θ i ), 1 ≤ i ≤ N }, representing the N oriented elements that will be displayed in the stimulus.Sections 2.6 and 2.7 describe how the actual stimulus is built from G.

Building a Patch

48In our stimuli a patch is a small h × h pixels square image showing the central part of a symmetrical Gabor function.The family of functions G f,θ,σ we use is defined by

49where f is the spatial frequency, σ the space constant and θ the orientation of the Gabor element.For our stimuli, we set h = 15 pixels, f = 0.12 cycles per pixel and σ = 1 4f pixels.These parameters, as well as the image dimensions (I = 500 pixels), were adjusted to produce visually satisfactory stimuli and were also inspired by the literature.However, other values could be used keeping in mind some practical constraints.The patch must be large enough to show the whole part of the Gabor function where it takes values different from the background; and not too large to avoid overlaps among patches.The value of f controls the thickness of this central blob.The smaller f , the thicker the blob and the more blurry the patch looks.Finally, setting σ proportionally to 1 f allows to control the number of blobs that are visible in the patch, independently of f .Increasing the coefficient of proportionality tends to let appear more cycles, and therefore more blobs, in the patch.

50Given the orientation θ of the patch (that is, the main orientation of the central blob), the value of pixel (i, j) in the patch is given by

51where c = 1+h 2 is such that (c, c) are the coordinates of the center of the patch (whether in Cartesian or matricial form).

Building the Final Stimulus

52First, the image I is initialized to the medium gray value.Then for each element (x i , y i , θ i ) ∈ G, a patch g i with orientation θ i is built as described in Section 2.6.Image I is actually a matrix, in which the origin of the coordinates is the upper left hand corner, and the first and second coordinates are the row and column indexes respectively.Since (x i , y i ) are intended as Cartesian coordinates in a classically oriented frame, we need to translate them into image coordinates prior to placing the patch in the image.This is why we define the central pixel of the patch and its top left hand corner as follows x

53where round(x) = x + 0.5 is the closest integer to x; and finally patch g i is placed in the image

54start : The p-value associated to the t-test is p = 0.49, which means that according to the performed test there is no significant difference between the areas of the target Voronoi cells and those of the background cells.

Formal Description of the Algorithm

55The generation algorithm, noted Algorithm 1 is described in detail by its pseudo-code.Here the associated p-value is p = 0.54.Like in Figure 8, this p-value means that according to the t-test there is no significant difference between the areas of the target and background Voronoi cells.Here the associated p-value is p = 0.97.Like in Figures 8 and 9, this p-value means that according to the t-test there is no significant difference between the areas of the target and background Voronoi cells.Θ ← setOrientations(θ a , α, idx a , actual N ) I ← buildStimulus(I, h, P, Θ, σ, f ) 10 return P, Θ, p, idx a , I Function setCoordinates(I, N, n in ).This function, called in Algorithm 1, takes as arguments the image side I in pixels, the total number N of elements and the number n in of aligned elements.The function returns a list P of N coordinates, representing the positions of the N elements; the set idx a of indexes of the aligned elements in P ; the orientation θ a of the alignment.

56Function placeAlignment(I, n in , d a , d marg ).This function, called in setCoordinates, takes as arguments the image side I in pixels, the number n in of aligned elements, the distance d a between consecutive aligned elements, in pixels, and the minimal distance d marg of any element from the image's edge, in pixels as well.If n in is too big (> n max ), the actual number of aligned elements will be n max .The function returns a set S of coordinates of the n aligned elements, and the direction θ a of this alignment.

574 n max ← I−2dmarg da + 1 // Maximal number of aligned elements that can fit in the image for any θ a

58Function placeBackground(S, N, r, I, d marg , d min ).This function, called in setCoordinates, takes as arguments the set S of coordinates of the aligned elements, the total number N of elements, the spatial resolution r for the coordinates of the elements, the image side I in pixels, the minimal distance d marg of any element from the image's edge in pixels, and the minimal distance d min of any element from its closest neighbor.The function returns a set P of N coordinates, representing the positions of the N elements.Function checkDensityCue(P, I, idx a ).This function, called in Algorithm 1, takes as arguments a set P of N coordinates, representing the positions of the N elements, the image side I in pixels, and the list idx a of indexes of the points in P belonging to the alignment.The function returns a p-value associated to a statistical comparison between the areas of the Voronoi cells of the aligned elements and those of the background elements.The user shall see p as a criterion to decide whether to reject the stimulus or not.If p is smaller than a significance threshold p min (to be chosen by the user, typically p min = .05),the stimulus should be rejected because the difference between the two sets of areas will be considered as significant.The value p = 0 means that the statistical test was not performed, and that the stimulus should be rejected no matter the significance threshold p min .Function SetOrientations(θ a , α, idx a , N ).This function, called in Algorithm 1, takes as arguments the direction θ a of the alignment, the angular jitter α, the list idx a of indexes in {1, . . ., N } corresponding to the aligned elements, and the total number N of elements.

59end end 10 return Θ Function buildStimulus(I, h, P, Θ, σ, f ).This function, called in Algorithm 1, takes as arguments the dimension I of the image's side, the dimension h of a patch's side, the list P of the patches' coordinates, the list Θ of the patches' orientations, the space constant σ and spatial frequency f that determines the aspect of a patch; the function returns the stimulus itself: a I × I pixels image representing the set of Gabor patches.

601 N ← #P 2 I ← 0.5 • ones(I, I)

Detection Algorithm

61The detection algorithm described in this section is based on the a contrario theory, which is a mathematical formulation of the non-accidentalness principle.An a contrario method requires two models.On the one hand, a geometric model, which is deterministic and, on the other hand, a probabilistic model.The geometric model defines an ideal structure x * along with a function d x * (•) measuring a deviation from it.For example, in our case, the ideal structure is a set of aligned Gabor patches with perfectly aligned orientations.The measure of a deviation from this ideal configuration, is detailed in Section 3.1 but we can already provide a hint of it: in Figure 12 (e) for example, the smaller the angles α i , the closer the depicted chain to a perfect alignment.

62The probabilistic model, also called a contrario or background model, is the statistical hypothesis H 0 of the absence of relevant structure -the so called null hypothesis.It represents the most general assumption on the data.Consistently with Attneave's principle stating that we do not perceive any structure in white noise [1], an a contrario model generally gives a maximal entropy to the building blocks of the percept.For example if these building blocks are oriented, their orientations must be random, independent, and uniformly distributed for each block.By Attneave's principle the emergence of a percept in a realization of such a model should be unlikely, and in any case purely accidental.Therefore this background model is used to test the significance of an observation, as follows.Let X be a random variable consistent with H 0 .Given an observed structure x with a deviation d x * (x) from the ideal structure, its relevance is measured by the probability P H 0 (d x * (X) ≤ d x * (x)) to be at least as close to x * under H 0 .Small deviations yield small probabilities, and are thus rare events in the background model.

63To evaluate the non-accidentalness of an event, an a contrario method takes into account the whole set of observations that were necessary to come across that particular event.For example, when looking for alignments in an array of Gabor patches, we define a priori a family of sets of patches, that will be tested as candidates to be alignments.This is what is usually called the family of tests, noted T , and N T denotes the number of tests in T .Then, given a tested candidate x that yielded the deviation d x * (x), denote by X 1 , X 2 , . . ., X N T , the random issues to the N T tests, under the background model H 0 .The question is now how common or, on the contrary, how surprising it would be to observe a deviation smaller than d x * (x) among these N T tests.An answer is to estimate the expected number of variables X i that verify d x * (X i ) ≤ d x * (x).The a contrario theory provides as an estimate a quantity called Number of False Alarms (NFA), defined as NFA

64In general the NFA is an upper-bound of the number of deviations to the ideal model smaller than d x * (x) that are expected to happen by accident in a set of N T random tests.

65In the following subsections, we detail the geometric and a contrario models for our study.

The Geometric Model

66For a given a tuple (g 1 , . . ., g n ) of n Gabor patches, we consider the variables α 1 , α 2L , α 2R , . . ., α (n−1)L , α (n−1)R , α n , as illustrated in Figure 12(e).Variable α iL is the absolute angle between the orientation of Gabor patch i and the line joining it to the patch i − 1, while α iR is the same thing changing i − 1 for i + 1.Since the first and last patches in the tuple have no previous and next elements respectively, we simply note α

67The ideal alignment that will be our reference structure in the present study, is such a tuple of Gabor patches for which all angles ω i s are equal to 0 rads.In words, it is a set of aligned patches whose orientations are the same as their line's orientation.

68Then we measure the deviation of a general tuple from an ideal alignment by its maximum angle ω * def = max{ω 1 , . . ., ω n }.

The A Contrario Model

69Now we need to define the a contrario model for our stimuli.Figure 13 shows three arrays of Gabor patches with only background elements and thus no significant alignment.Formally, we model an array of N Gabor patches by a set g = {(x i , θ i )} i=1...N , where x i ∈ R 2 represents the coordinates of patch number i, and θ i ∈ R its orientation.We note x def = {x 1 , . . ., x N } and, for any three points x, y, z ∈ x, φ xyz is the angle between vectors − → xy and − → yz.Finally, the set of the 6 nearest neighbors of a point x ∈ x is noted N 6 (x) (see Figures 12 (a) and (b)).Then we define an a contrario array of Gabor patches as a random set G = {(X i , Θ i )} i=1...N verifying two properties:

701.The random variables Θ 1 , . . ., Θ N are independent and uniformly distributed in [0, 2π).

For any

71, and is independent from Φ * X Y for any (X , Y ) = (X, Y ).

72Let's clarify the relation between this definition and the background stimuli of Figure 13.Property 1 corresponds exactly to the rule we used to define the background elements' orientations in our arrays of patches (see Section 2.5).The relevance of property 2 needs more justification.As explained in Sections 2.1 and 2.3, we built each stimulus so that N elements fit in it, that two elements were not too close to each other, and that there were no empty regions in the image.The most compact way to fit discs in a given region is to lay them on a hexagonal lattice.Here we chose the minimal distance between elements in order to allow some randomness in their coordinates.The resulting stimuli look like hexagonal lattices affected by some noise, in which property 2 approximately holds (see Figure 12 (a)).As illustrated in Figure 12 (d), in such an approximately hexagonal lattice, we expect the maximal value for the angle Φ * XY to be roughly π 6 .Since we do not know the actual distribution of Φ * XY , the simplest assumption is then the uniform distribution in [0, π 6 ), which does not require to set any parameter.We checked that the empirical distribution of Φ * XY is reasonably close to our assumption.

Input of the Algorithm

73The input of the detection algorithm is a set g = {(x i , θ i )} i=1...N , that models a Gabor array composed of N patches (see Section 3.2).

The Family of Tests

74The family of tests is defined by first building a graph γ on the set x = {x 1 , . . ., x N }, and then selecting chains of adjacent edges in this graph.

75The graph γ.The oriented graph γ = (x, e), where x is the set of vertices and e the set of edges, is defined as follows: (x i , x j ) ∈ e if and only if x j is one of the 6 nearest neighbors of x i and d(x i , x j ) ≤ d max , where d(x i , x j ) is the Euclidean distance between the two points, and d max the maximal length we accept for an edge (see next paragraph).We will denote by N γ (x) the set of neighbors of x in γ; see Figure 12 (a).Maximal edge's length.The maximal length for an edge is based on a statistic of the distances between a point and its nearest neighbor in x.We list the N distances of each point x i ∈ x to its nearest neighbor, and define d avg as the mean value of this list.Then we take as maximal length for an edge d max def = 2d avg .This is just an empirical choice to avoid too long edges in the graph.

76The chains to be tested.A chain (z 1 , z 2 , . . ., z n ) is in the family of tests T if and only if the following conditions are fulfilled

77where

78In words, the chains to be tested are sequences of adjacent elements in γ that minimize the angles between consecutive edges.Figure 12 (c) shows six examples of chains to be tested, each starting from the same point and composed of five elements.

79The number of tests is approximately

80N T is actually an overestimation of the number of tests, since not all nodes in γ have six neighbors, and we only test chains containing at least three elements.

The NFA

81The NFA of each chain c = (z 1 , . . ., z n ) of T is defined as follows.Consider the variables ω 1 , . . ., ω n , as defined in Section 3.1 and illustrated in Figures 12(e) and (f).Under the assumption that g is a realization of an a contrario array of Gabor patches, the orientations ω 1 , ω 2 , . . ., ω n are samples of n independent random variables Ω 1 , Ω 2 , . . ., Ω n .Ω 1 and Ω n are uniformly distributed in [0, π 2 ],

82and a short development, presented in the Appendix, shows that Ω 2 , . . ., Ω n−1 have a cumulative distribution function

83Note that for a random patch Z i in a chain, the probability law of max(α iL , α iR ) depends on the angle Φ * Z i−1 Z i .The cumulative distribution function F is obtained by integrating over all possible values for Φ * Z i−1 Z i , according to the law hypothesized in the a contrario model.Noting ω * def = max{ω 1 , . . ., ω n }

84and Ω * def = max{Ω 1 , . . ., Ω n }, the probability that all Ω i be less than the observed ω * is

85As usual in the a contrario theory, we get a natural definition of the NFA of chain c

Output of the Algorithm

86The algorithm returns the lowest NFA and the chain that achieves it.When the a contrario theory is applied to computer vision, the common practice is to detect only structures with NFA below a certain threshold (typically, NFA = 1).Like in [2], we want to compare the detection algorithm to visual perception on an objective task, in which both the subject and the algorithm are forced to report the most salient structure in the stimulus.If we allowed the algorithm to report no detection at all, we should give the same possibility to human observers, and this would introduce more subjectivity: the subject could actually see something and decide not to consider it as a significant alignment.Moreover, we are also interested in the NFA value of the target alignment, whether it is detected or not (see demo).

Examples of Detections

87In this section we present a few examples illustrating the behavior of the detection algorithm.Figures 14 and 15 are the most representative cases: the algorithm detects the target alignment when it is conspicuous (Figure 14), but does not when it is perceptually hard to distinguish the alignment from the background (Figure 15). Figure 16 and 17 show two examples where human observers perceive the target alignment whereas it is not detected by the algorithm.In Figure 16, despite the high level of orientation jitter, human subjects could detect a part of it, composed of the third, fourth and fifth elements starting from the top.The reason is probably that the position masking left a larger space around these three elements.Note that the statistical test on density cue yields a p-value of 0.79, and therefore does not point out the inefficiency of the masking here.Figure 16 also shows the algorithm's tendency to detect curved structures when no salient alignment is present.In Figure 17, the algorithm prefers a short alignment, although the target alignment seems more salient.

88On the contrary, Figure 18 illustrates the cases where the algorithm finds the target alignment whereas the latter is not so easy to perceive for a human observer.Because it is quite long and not so affected by angular jitter the target is expected to be easy to spot.However in this stimulus, other alignment-like structures occurred by chance in a more central part of the image, which tend to draw our attention away from the target alignment.

89Finally, in Figure 19 we see how the algorithm sometimes detects a chain that includes the target alignment.The latter is not significant enough to be detected alone, but participates in the detection of the bigger set.In the present example the algorithm contradicts our perception, since we tend to see the target and not the longer chain.The fact that the detected structure is curved instead of a straight alignment, shows another limitation of our algorithm.We tried several strategies to constrain the curvature of the chains by including it in the computation of the NFA.In general, this did prevent to detect curves rather than alignments.However, for all the formulations we tried, this also often led to detecting target alignments that were not perceived by human observers.In other words, we have not found the appropriate trade-off between curvature and consistency within orientations.The algorithm presented here is, among the approaches we tried, the one that best matches the human data [2].

90The examples presented above are meant to give an idea of the limitations of the algorithm in some particular cases.However, in general, the algorithm provides quite accurate predictions of the perception of alignments in our stimuli.For a detailed presentation of these results, we kindly refer to [2].

Target alignment

91Stimulus (input) Detection: NFA = 0.91 Figure 14: Example of detection in a stimulus composed of N = 100 patches, with n = 6 elements affected by a jitter α = 0.3π 2 .In general the algorithm detects the target alignment when it is conspicuous.

Formal Description of the Algorithm

92The detection algorithm, noted Algorithm 2 is described in detail by its pseudo-code.

Target alignment

93Stimulus (input) Detection: NFA = 22

94Each angle θ i is supposed to be the orientation of a Gabor element placed at x i .output: The smallest NFA value NFA * , and the associated set of Gabor elements

95, γ a N ×N adjacency matrix representing an oriented graph on x, and c an ordered list of indexes, corresponding to a chain of points of x.The function returns an index in {1, . . ., N }, which corresponds to the point which should expand the current chain c.

96Function nfa(C, x, Θ). x = {x i } i=1...N is a set of N points in R 2 , Θ = {θ i } i=1...N a set of N angles in [0, 2π), and C = (i 1 , i 2 , . . ., i n ) a tuple of n indexes in {1, . . ., N }.

Conclusion

97This paper has presented a method aiming at interpreting and quantifying the perceptual grouping of aligned oriented elements in arrays of Gabor patches.The method is composed of two main algorithms: first, a generation algorithm designed to build stimuli in which perceptual grouping is almost only due to the orientations of the patches; second, a detection algorithm designed to find the target alignments only when they are conspicuous for human visual perception.This parameterless algorithm is based on the a contrario theory, a mathematical model of the non-accidentalness principle.These methods were applied and tested in psychophysical experiments [2], where the NFA showed strong correlation with the detectability for human subjects, and the algorithm proved to be an accurate predictor of the average subject's behavior.Therefore, the framework presented here is a tool to test the relevance of the a contrario approach to perceptual tasks in image processing and computer vision.

Appendix

98To analyze the distribution of the random variables Ω i we start by analyzing the possible values ω when the chain at point i has an angle between the previous (L) and next (R) element of ϕ, see Figure 20.Given that ω is the largest of α L and α R , for a given ϕ the possible orientations for the Gabor element are classified into four sectors, in two of them ω = α L and in the other two ω = α R .Indeed, at the orientation of the bisector of the two lines L and R, α L = α R .The same happens at the bisector of R and the continuation of L and inversely.

99Let us analyze the distribution in one of the sectors; the same distribution is observed in the three others and the reader can fill the details.The minimal possible value for ω is ϕ 2 , as can be seen at the orientation marked with the letter A in Figure 21.Indeed, that orientation is the bisector of line R and the continuation of line L, which form an angle ϕ.As the orientation increases clockwise, the corresponding angle ω increases gradually, passing the orientation marked with the letter B, where ω = π 2 − ϕ 2 , until arriving at the orientation C, which is orthogonal to line L and gives the maximal possible value ω = Also, the probability that ω be in the first interval is equal to the probability that the Gabor element be oriented between A and B, that is 2 π ( π 2 − ϕ); similarly, the probability that ω be in the second interval is equal to the probability that the Gabor element be oriented between B and D, that is 2ϕ π .This allows to deduce the values of a and b, which gives the following probability density function for ω, given a fixed ϕ p(ω|ϕ

Figure 2 :

100Figure 2: Illustration of the perception of alignments in arrays of Gabor patches.The displayed elements have the same coordinates in all three images.In the left hand image, 10 elements are aligned and have the same orientation as their line, whereas the other elements are randomly oriented.In the right hand image, all elements have random orientations, even the 10 elements that appear aligned on the left hand image.The central image only shows the coordinates of the elements, without any orientation.An alignment is perceptible only in the left hand image, where the aligned elements have the same orientation as their line.

Figure 4 :

101Figure 4: (a) The authorized image region for the elements of the stimulus: a I × I pixels square, deprived of d b pixels wide horizontal and vertical margins.(b) A discrete homogeneous line-segment, composed of n = 10 points, with spacing d a , center (x c , y c ), and direction θ a .In the implementation of the algorithm, we will take the left hand lower corner as the origin of the coordinates.

Figure 5 :

102Figure 5: Illustration of the procedure to set the coordinates of the background points.Every picture represents I at different steps of the procedure.The white pixels represent the authorized region A at each step.(a) Initialization of I , only the pixels along the margins are set to f alse, and A is the inner white square.(b) Update of A after the dilation of the set S initialized with the aligned points.(c)-(e) Dilation of S after definition of one, two and 50 background points.

Figure 6 :

103Figure 6: Voronoi cells for a set of points.Only cells that are fully included in the image domain are taken into account.Cells are filled in gray for background points and in light red for the aligned points.The check for density cue is a statistical t-test of the hypothesis that the areas of the target and background cells are samples of two normal distributions with equal means.

Figure 7 :

104Figure 7: Orientation of a target element, chosen randomly from a uniform distribution over [θ a − α, θ a + α].

Figures 8 , 9 ,

105Figures 8,9, 10 and 11 are four examples of stimuli built with the proposed algorithm.The first three examples show satisfactory stimuli in which no significant density cue was found, that is the perceptual grouping only depends on the orientations of the target elements.In Figure11however, the alignment is perceptible despite the maximal angular jitter affecting the target elements.The low associated p-value helps as a criterion to reject this stimulus.

Figure 8 :

106Figure 8: Example of a stimulus with N = 100, n = 5 and α = 0.3•π 2 .The p-value associated to the t-test is p = 0.49, which means that according to the performed test there is no significant difference between the areas of the target Voronoi cells and those of the background cells.

Figure 9 :

107Figure 9: Example of a stimulus with N = 200, n = 7 and α = 0.5•π 2 .Here the associated p-value is p = 0.54.Like in Figure8, this p-value means that according to the t-test there is no significant difference between the areas of the target and background Voronoi cells.

Figure 10 :

108Figure 10: Example of a stimulus with N = 600, n = 9 and α = 0.1•π 2 .Here the associated p-value is p = 0.97.Like in Figures8 and 9, this p-value means that according to the t-test there is no significant difference between the areas of the target and background Voronoi cells.

Figure 11 :

109Figure 11: Example of a stimulus with N = 100, n = 9 and α = π 2 .The p-value associated to the t-test is p = 0.013, which indicates, according to the common threshold p min = 0.05, that there might be a significant difference between the areas of the target Voronoi cells and those of the background cells.It is indeed relatively easy to spot the alignment in the left hand image, and in the central image.

1 I = I r 2 d min = d min r 3 d marg = dmarg r 4 S 8 I

110← 1 r • S // Initialize I according to Equation (12), as illustrated in Figure 5(a) 5 I ← f alse(I , I ) 6 for x = d marg + 1 to I − d marg do 7 for y = d marg + 1 to I − d marg do (x , y ) ← true 9 end end // Second step of the initialization: turn to false the discs around the aligned elements, as illustrated in Figure 5(b) D ← structuralElement(disk, d min ) pool ← f alse(I , I ) pool(S ) ← true// Set to true the points in pool with the coordinates contained in S pool ← dilation(pool, D)// Dilation of the aligned elements I ← I and ¬ pool// Update I according to Equation (13) A ← {(x , y ) ∈ [1, I ] 2 , I (x , y ) = true}// Authorized region as defined by Equation (11) // Start the loop to place background elements, as illustrated in Figure 5(c), (d) and (e) placed ← #S// Initialize the number of already placed elements to the number of aligned elements that could be placed B ← ∅// Initialize the set of discrete background points while placed < N and A = ∅ do newP t ← rand(A)// Choose randomly an element from the authorized region B ← B ∪ newP t// Add the new element to the set of discrete background points pool ← f alse(I , I ) pool(newP t) ← true pool ← dilation(pool, D)// Dilation of the placed elements I ← I and ¬ pool// Update I according to Equation (13) placed ← placed + 1 A ← {(x , y ) ∈ [1, I ] 2 , I (x , y ) = true}// Authorized region as defined by Equation (11) end // Transform the discrete coordinates of background points back to non-integer coordinates B ← ∅ for p ∈ B do p ← (p − 1)r + r × rand([0, 1] 2 ) B ← B ∪ p end P ← S ∪ B return P

Figure 12 :Figure 13 :

111Figure 12: (a) On this array of 100 Gabor patches, we represent the associated graph γ (the orientations of the edges were omitted).In this graph, most of the points are linked to their 6 nearest neighbors, except when a neighbor is too remote, as it often happens for elements that are close to the image border.For a point x ∈ x (circled in white in (a)), a chain (x, y) is started for each y ∈ N γ (x) in (b), and expanded in (c) into the most rectilinear possible chain.Picture (c) shows the result after 3 iterations of the expansion process.(d) Given two neighbors x and y, we look for the neighbor z of y that minimizes the absolute angle between − → xy and − → yz.(e)-(f) The variables the algorithm measures when analyzing a chain containing n = 4 points.

Figure 15 :Figure 16 :Figure 17 : 14 Figure 18 : 21 Figure 19 :

112Figure 15: Example of detection in a stimulus composed of N = 200 patches, with n = 9 elements affected by a jitter α = π 2 .In general the algorithm does not detect the target alignment when it is perceptually hard to distinguish from the background.

1 p 1 ← 8 p 1 ← x i k− 1 9p 2 ← x i k p 3 ← 2 2

113x i 1 2 p 2 ← x i 2 3 p n−1 ← x i n−1 4 p n ← x n 5 ω 1 ← |angularError(p 1 , p 2 , θ i 1 )| 6 ω n ← |angularError(p n−1 , p n , θ in )| 7 for k = 2 to n − 1 do x i k+1 α L ← |angularError(p 1 , p 2 , θ i k )| α R ← |angularError(p 2 , p 3 , θ i k )| ω k ← max(α iL , α iR ) end ω * ← max{ω 1 , ω 2 , . . ., ω n } N T ← 6 × N × √ N // (Equation (23))p ← πω * × F (ω * ) n−2 // (Equation (24) and (25))

π 2 .

114Then, as the orientation goes still clockwise to the orientation D, the ω decreases gradually to angle π 2 − ϕ 2 , which is the angle of the bisector of lines L and R. Since the orientation of the Gabor element is uniformly distributed, the values for ω are equiprobable in [ ϕ 2 , π 2 − ϕ 2 ], and so are the values in [ π 2 − ϕ 2 , π 2 ].The probability density function for ω, given a fixed ϕ can therefore be written p(ω|ϕ) = a1 [ ϕ 2 , π 2 − ϕ 2 ) (ω) + b1 [ π 2 − ϕ 2 , π 2 ] (ω).

Figure 20 : 2 Figure 21 :

115Figure 20: For a fixed ϕ, depending on the orientation of the Gabor element, the angle ω = max(α L , α R ) is equal to α L or α R .Here we represent the different cases according to the orientation of the Gabor element.

116Function angularError(p 1 , p 2 , θ). p 1 and p 2 are two points in R 2 whose abscissa and ordinates are noted p i .xand p i .y;θ is an angle in [0, 2π).// First compute the orientation of line (p 1 p 2 ), noted θ 12 , in (− π 2 , π 2 ] 1 if p 1 .x= p 2 .xthen 2 θ 12 ← arctan p 1 .y−p 2 .yp 1 .x−p 2 .x∆ ang ← arctan(tan(θ 12 − θ)) // With the convention: tan(± π 2 ) = ±∞ and arctan(±∞) = ± π

117nf a ← N T • p // (eq 26) return nf a

참고문헌 25건

  1. Organization in vision: Essays on gestalt perception 1979
  2. Perceptual Organization in Vision 2002 10.1002/0471214426.pas0105
  3. Vision Science: Photons to Phenomenology 1999
  4. Component processes in contour integration: A direct comparison between snakes and ladders in a detection and a shape discrimination task Vision Research · Elsevier BV · 2013 10.1016/j.visres.2013.09.003
  5. The role of vertical mirror symmetry in visualshape detection Journal of Vision · Association for Research in Vision and Ophthalmology · 2009 10.1167/9.12.11
  6. Untersuchungen zur Lehre von der Gestalt. II Psychological Research · Springer Science+Business Media · 1923 10.1007/bf00410640
  7. The construction of perceptual grouping displays using GERT Behavior Research Methods · Springer Science+Business Media · 2011 10.3758/s13428-011-0167-8
  8. Integration of contour and surface information in shape detection Vision Research · Elsevier BV · 2010 10.1016/j.visres.2010.11.005
  9. Peripheral Contour Grouping and Saccade Targeting: The Role of Mirror Symmetry Symmetry · Multidisciplinary Digital Publishing Institute · 2014 10.3390/sym6010001
  10. A century of Gestalt psychology in visual perception: II. Conceptual and theoretical foundations. Psychological Bulletin · American Psychological Association · 2012 10.1037/a0029334
  11. A closed curve is much more than an incomplete one: effect of closure in figure-ground segmentation. Proceedings of the National Academy of Sciences · National Academy of Sciences · 1993 10.1073/pnas.90.16.7495
  12. Contour integration by the human visual system: Evidence for a local “association field” Vision Research · Elsevier BV · 1993 10.1016/0042-6989(93)90156-q
  13. The influence of orientation jitter and motion on contour saliency and object identification Vision Research · Elsevier BV · 2009 10.1016/j.visres.2009.08.002
  14. Grouping local orientation and direction signals to extract spatial contours: Empirical tests of “association field” models of contour integration Vision Research · Elsevier BV · 2005 10.1016/j.visres.2005.04.002
  15. Some informational aspects of visual perception. Psychological Review · American Psychological Association · 1954 10.1037/h0054663
  16. A century of Gestalt psychology in visual perception: I. Perceptual grouping and figure–ground organization. Psychological Bulletin · American Psychological Association · 2012 10.1037/a0029333
  17. LSD: a Line Segment Detector Image Processing On Line · Image Processing On Line · 2012 10.5201/ipol.2012.gjmr-lsd
  18. LSD: A Fast Line Segment Detector with a False Detection Control IEEE Transactions on Pattern Analysis and Machine Intelligence · IEEE Computer Society · 2009 10.1109/tpami.2008.300
  19. Measuring the visual salience of alignments by their non-accidentalness Vision Research · Elsevier BV · 2015 10.1016/j.visres.2015.08.014
  20. From Gestalt Theory to Image Analysis Interdisciplinary applied mathematics · Springer Nature · 2007 10.1007/978-0-387-74378-3
  21. Perceptual Organization and Visual Recognition Kluwer international series in engineering and computer science · Springer Nature · 1985 10.1007/978-1-4613-2551-2
  22. A source book of Gestalt psychology. Kegan Paul, Trench, Trubner & Company eBooks · Kegan Paul, Trench, Trubner & Company · 1938 10.1037/11496-000
  23. Human and Machine Vision Elsevier eBooks · Elsevier BV · 1983 10.1016/c2013-0-10347-9
  24. What is perceptual organization for International Joint Conference on Artificial Intelligence · 1983
  25. Quantifying density cues in grouping displays Vision Research · Elsevier BV · 2015 10.1016/j.visres.2015.06.004