Sensitivity to grayscale textures is adapted to natural scene statistics

The efficient coding hypothesis posits that sensory circuits and animal behavior should be adapted to the statistical structure of natural signals. Here, we show that the perception of visual textures is adapted to the spatial distribution of light signals at a striking level of detail. We first identify a parametrized 66-dimensional space of grayscale textures defined by local spatial correlations between discrete light intensities. We then devise a method of measuring the contribution of each of these textures to the spatial structure of scenes. Efficient coding predicts that the perceptual salience of a complex sensory signal should be related to its variability in natural settings. Based on an analysis of contrast-equalized natural scenes, this theory predicts that textures involving two-point correlations will be most salient, and it further predicts the relative salience among second-order correlations of different types. We test our predictions by asking observers to locate a briefly-flashed texture strip in a background of white noise. The behavior of individual subjects is highly consistent: correlations beyond the second order are hard to distinguish from random noise, and detection thresholds within this salient second-order subspace are quantitatively predicted across 26 two-dimensional texture planes. We additionally find non-trivial symmetries of natural images that leave psychophysical thresholds unchanged, further supporting our hypothesis. These findings significantly extend previous results obtained for binary images, and they provide deeper insights into the relationship between natural signal statistics and human perception.


Introduction
Neural circuits in the periphery of the visual [1,2,3,4,5,6,7,8,9], auditory [10,11,12,13], and perhaps also olfactory [14] systems use scarce resources efficiently to represent sensory information by adapting to the statistical structure of the environment [15].There is some evidence that this sort of efficient coding might also occur more centrally, in the primary visual cortex [16,17,18,19] and perhaps also in the entorhinal cortex [20].Behaviorally, efficient coding implies that the threshold 1 arXiv:1912.05433v1[q-bio.NC] 11 Dec 2019 for perceiving a complex sensory cue, which depends on the collective behavior of many cells in a cortical circuit, should be set by its variance in the natural environment.However, the nature of this relationship depends on the regime in which the sensory system operates.Specifically, in conventional applications of efficient coding theory where sampling is abundant, high variance is predicted to be matched by high detection thresholds.The authors of [21] argued instead that texture perception occurs in a regime where sampling noise is the limiting factor.This leads to the opposite prediction [21,22,23], namely that high variance should lead to a low detection threshold, summarized as variance is salience [21].Tests of this prediction in [21,22] showed that it holds for the visual detection of simple black-and-white binary textures.
These binary textures, while informative about visual sensitivity, are a highly restricted set and do not capture many perceptually-salient properties of natural scenes.Moving to a complete description of visual textures, however, requires specifying the co-occurrence of all possible patterns of light across a visual image, and is generally intractable.One way to make this specification tractable is to construct a local and discretized grayscale texture space, in which luminance is drawn from a discrete set and correlations in luminance are only specified up to a given neighborhood size.For example, if we consider four spatially-contiguous squares ("checks") with binary intensities, there are 2 4 = 16 patterns that can each occur with different probabilities in a given texture.Imposing translation symmetry constrains these 16 parameters, leading to a 10-dimensional space of textures [21].This space can be explored by synthesizing artificial binary textures with prescribed combinations of parameters [24,25], and by analyzing the relative contributions of these parameters to the correlated structure of natural images [21,22].Here, we generalized these synthesis and analysis methods to multiple gray levels and used this to probe efficient encoding of grayscale textures composed of correlated patterns of three luminance levels (dark, gray, light) specified within blocks of four contiguous checks.We chose to add only one intermediate gray level compared to the binary case because it is the simplest generalization of binary textures that allows us to explore perceptual sensitivity to grayscale textures.Because the number of possible visual patterns increases as a power law in the number of distinguishable luminance values, this generalization already yields a very high-dimensional space: for intensities constrained to G = 3 discrete values, there are G 4 = 81 patterns of four checks with three gray levels, leading to a 66-dimensional space of textures after accounting for translation invariance.
This grayscale texture space enabled us to probe and interpret the relationship between natural scene statistics and psychophysics in much greater detail than is possible with binary textures.In particular, the "variance is salience" hypothesis qualitatively predicts that directions corresponding to two-point correlations will be most perceptually salient, 1 and it quantitatively predicts detection thresholds in different directions of this salient part of the texture space.We tested these predictions by asking observers to report the location of textured strips presented rapidly against a background of white noise, and we found detailed agreement with the theory.By further exploiting symmetries in the distribution of grayscale textures, we show that human behavior not only reflects the relative informativeness of natural visual textures, but it also parallels known invariances in natural scenes. 2  1 Two coordinates corresponding to contrast, which are also highly salient, are zeroed out by the preprocessing in our natural image analysis.Thus, we do not probe these directions in texture space. 2 Natural scenes also have a notable, previously studied, asymmetry between bright and dark [5,22] which is reflected in the anatomy and physiology of visual circuits, and in visual behavior [5,22,26,27,28,29,30].The asymmetry is rooted ultimately in the log-normal distribution of light intensities in natural scenes [5,31].Our image processing pipeline (see Methods) starts by taking the logarithm of the pixel intensities and thus removes the dark-light asymmetry, allowing us to focus on other aspects of natural scene statistics.We parametrize the pairwise correlations within these blocks using modular sums or differences of luminance values at nearby locations, mod(A ± B, 3) (see Methods and Supplement for details).This notation denotes the remainder after division by 3, so that for example mod(4, 3) = 1 and mod(−1, 3) = 2.The texture coordinates are defined by the probabilities p0, p1, p2 with which mod(A ± B, 3) equals its three possible values, 0, 1, or 2. These probabilities sum to 1, so there are only two independent coordinates.B. The eight second-order groups (planes) of texture coordinates in the ternary case.Each choice of orientation of the pair of checks for which the correlation is calculated, and whether a sum or a difference of luminance values is used, identifies a texture group.The greek letter notation (β for the second-order planes) mirrors the notation used in [21].C. and D. Example texture groups ("simple" planes).The origin is the point p0 = p1 = p2 = 1/3, representing an unbiased random texture.The interior of the triangle shows the allowed range in the plane where all the probability values are non-negative.The vertices are the points where only one of the probabilities is nonzero.An example texture patch is shown for the origin, as well as for each of the vertices of the probability space.

Local textures with multiple gray levels
We define textures in terms of statistical correlations between luminance levels at nearby locations, generalizing the methods developed for binary images [21,32] to three luminance levels.If we consider four "checks" arranged in a 2 × 2 square, the three luminance levels lead to 3 4 = 81 possible patterns, and their frequency of occurrence in an image is equivalently parameterized by intensity correlations within the square.Thus there is an 81-dimensional space of ternary textures defined by correlations within square arrangements of checks.However, translation invariance constrains these 81 probabilities, reducing the number of independent statistics and thus the dimension of the texture space.
We can quantify the statistics of such textures in an image patch by gliding a 2 × 2 block (a "glider") over the patch and analyzing the luminance levels at different locations within this block (Figure 1A).At the most basic level, we can measure the luminance histogram at each of the four check locations in the glider.Check intensities can take three values (0, 1, or 2, for black, gray, or white), and the corresponding frequencies of occurrence must add to one, leaving two free parameters.
If the histograms at each of the four locations within the glider were independent, this would lead to 4 × 2 = 8 texture dimensions.However, because of translation invariance in natural images, the luminance histograms at each location must be the same, leaving only 2 independent dimensions of texture space from the single-check statistics.
Next, we can analyze the statistics of luminance levels at pairs of locations within the glider.Taking into account translation-invariance, there are four ways to position these pairs (Figure 1B), each with a different orientation.For each orientation, we can calculate either the sum A + B or the difference A − B of the luminance values A and B at the two locations.This yields eight possible texture groups (Figure 1B).Within each group, we build texture coordinates by counting the fraction of occurrences in which A ± B is equal to 0, 1, or 2, up to a multiple of 3 (see Methods and Supplementary Information).These fractions must add up to 1, so that each texture group is characterized by two independent coordinates, i.e., a plane in texture space.These 8 planes constitute 16 independent dimensions of the texture space, in addition to the two dimensions needed to capture the histogram statistics at individual locations.An image with specified texture coordinates can be generated using an algorithm that generalizes the methods from [32] (see Methods and Supplementary Information for details).Examples of texture patches obtained by co-varying coordinates within a single texture group are shown in Figures 1C and 1D.Examples of textures obtained by co-varying coordinates in two texture groups are shown in Figure 2. We refer to the first case as "simple" planes, and the second as "mixed" planes.
We can similarly analyze the joint statistics of luminance levels at three checks within the glider, or all four together.There are four ways to position 3-check gliders within the 2 × 2 square, and, for each of these positions, 8 parameters are needed to describe their occurrence frequencies, once the first-and second-order statistics have been fixed.This leads to 4 × 8 = 32 third-order parameters.For configurations of all four checks, 16 parameters are required, once first-, second-, and third-order parameters are fixed.These 32 + 16 = 48 parameters, in addition to the 18 parameters described above, lead to a 66-dimensional texture space.This provides a complete parameterization of the 2 × 2 configurations with three gray levels.See Methods and Supplementary Information for a detailed derivation and a generalization to higher numbers of gray levels.
When applying these methods to the analysis of natural images, we bin luminance values to produce equal numbers of black, white, and gray checks (details below), thus equalizing the previously studied brightness statistics in scenes (e.g., [5,22,26,27,28,29,30,31]).This procedure allowed us to focus on higher-order correlations.In previous work, we found that median-binarized natural images show the highest variability in pairwise correlations, and that observers are correspondingly most sensitive to variations in these statistics [21,31].In view of this, we focused our attention on pairwise statistics.For three gray levels, these comprise a 16-dimensional "salient" subspace of the overall texture space.

Natural image statistics predict perceptual thresholds
Predictions from natural scene statistics.The "variance is salience" hypothesis from [21] predicts that the most salient directions in texture space (for which detection thresholds are low) will be those along which there is the highest variance across image patches, while the least salient directions (for which detection thresholds are high) will be those with lowest variance.To test these predictions, we first mapped natural image patches to their corresponding locations within the texture space (as in [21]).We then computed the inverse of the standard deviation of the natural image distribution along each direction, and we used this as our prediction of detection thresholds (details in Methods).Images were taken from the UPenn Natural Image Database [31] and preprocessed as shown in Figure 3A (see Supplementary Information for details).Starting with a logarithmic encoding of luminance, we downsampled each image by averaging over N × N blocks of pixels to reduce potential camera sampling artifacts.We then split the images into non-overlapping patches of size R, filtered the patches to remove the average pairwise correlation expected in natural  A. Psychophysical trials used a four-alternative forced-choice task in which the subjects identified the location of a strip sampled from a different texture on top of a background texture.B. The subject's performance in terms of fraction of correct answers was fit with a Weibull function and the threshold was identified at the mid-point between chance and perfect performance.Note that if the subject's performance never reaches the mid-point on any of the trials, this procedure may extrapolate a threshold that falls outside the valid range for the coordinate system (see, e.g., the points outside the triangles in panel C).This signifies a low-sensitivity direction of texture space.C. Measured (red crosses with pink error bars; the error bars are in most cases smaller than the symbol sizes) and predicted (blue dots) thresholds in second-order simple planes.Thresholds were predicted to be inversely proportional to the standard deviation observed in each texture direction in natural images.The plotted results used downsampling factor N = 2 and patch size R = 32.A single scaling factor for all planes was used to match to the psychophysics.The orange and green dotted lines show the effect of two symmetry transformations on the texture statistics (see text).
images [3], and finally ternarized patches to produce equal numbers of black, gray, and white checks (Figures 3A, 3C, and 3D).For most figures shown in the main text, we used N = 2 and R = 32.Each patch was then analyzed in terms of its texture content and mapped to a point in ternary texture space following the procedure described in Sec.2.1.Finally, to avoid biases due to blurring artifacts, we fit a two-Gaussian mixture model to the texture distribution and used this to separate in-focus from blurred patches (Figure 3B) ( [21]; details in Methods).We found that natural images have much higher variance in the second-order coordinate planes than in the third-and fourth-order planes.This predicted that textures exhibiting variability in the second-order planes would be most salient to observers, and thus would be amenable to a quantitative comparison between theory and behavior.Thus, we computed the predicted detection thresholds in four single and twenty-two mixed second-order coordinate planes, and we scaled this set of thresholds by a single overall scaling factor that was chosen to best match the behavioral measurements (blue dots in Figure 4C and Figure 5).Psychophysical measurements.To measure the sensitivity of human subjects to different kinds of textures, we used a four-alternative forced-choice paradigm following [21,32,33,34].Subjects were briefly shown an array in which a rectangular strip positioned near the left, right, top, or bottom edge was defined by a texture difference: either the strip was structured and the background was unstructured, or the background was structured and the strip was unstructured.Structured patterns were constructed using the texture generation method described above, and unstructured patterns were generated by randomly and independently drawing black, gray, or white checks with equal probability.Subjects were then asked to indicate the position of the strip within the array (Figure 4A).Thresholds were obtained by finding the value of a texture coordinate for which the subjects' performance was halfway between chance and perfect (Figure 4B; see Methods for details).For the second-order planes, subjects were highly consistent in their relative sensitivity to different directions in texture space, with a single scaling factor accounting for a majority of the inter-subject variability (see Supplementary Information).The subject-average thresholds in the second order planes are shown in Figure 4C and Figure 5 (red crosses and error bars).As predicted by the natural scene analysis, sensitivity in the third and fourth-order planes was low; in fact, detection thresholds could not be reliably measured in most directions beyond second order (Supplementary Information and Figure 10).
Variance predicts salience.Predicted detection thresholds were in excellent agreement with those measured experimentally (Figure 4C and Figure 5), with a median relative error of around 12%.This match is unlikely to be due to chance-a permutation test yields p < 10 −4 for the hypothesis that all measured thresholds were drawn independently from a single distribution that did not depend on the texture direction in which they were measured (see Methods and Supplementary Information for details and further statistical tests).The comparison between theory and experiment was tested in 12 directions in each of 26 single and mixed planes, for a total of 311 different thresholds (the uncertainty in one direction in the β ++ [0]; β + + [1] mixed plane was too large, and we discarded that datapoint)3 ; a single scaling factor was used to align these two sets of measurements.
However, not all thresholds are accurately predicted from natural images.While some of the mismatches occur for directions in texture space where the experimental data has large variability (pink error bars in Figure 4C and Figure 5), there are systematic mismatches in the β ++ and β + + planes (Figure 4C) that are many times the experimental uncertainty.This discrepancy points to limits of the efficient-coding model.Such limits should be expected: adapting to increasingly precise environmental statistics ultimately must become unfeasible, both because of insufficient sampling, and because of the growing computational cost required for adaptation.
Another observation is that the natural-image predictions tend to underestimate the thresholds in directions with very low variance, perhaps pointing to the need to go beyond the linear efficient-coding model employed here.A simple method asks whether the measured thresholds are better predicted by a power-law transformation of the natural-image variances, threshold ∝ (standard deviation) −β , with β = 1 being the default value used throughout the text.The exponent β that best matches the data is close but probably not equal to 1 (the 95% credible interval is [0.81, 0.98]; see Supplementary Information) suggesting that a weak power-law nonlinearity might be involved.
Our analysis is robust to several variations in our analysis procedure.We obtain similar results when we either vary the sub-sampling factor N and patch size R, modify the way in which we ternarize image patches, or analyze different image datasets (Figure 6A and Supplementary Information).Eliminating downsampling (choosing N = 1) does lead to slightly larger mismatches between predicted and measured thresholds (first three distributions on the left in Figure 6A) as expected from [21], a finding that we attribute to artifacts arising from imperfect demosaicing of the camera's filter array output.

Invariances in psychophysics recapitulate symmetries in natural images
The "variance is salience" hypothesis can be further tested by asking whether symmetries of the natural distribution of textures are reflected in invariances of psychophysical thresholds.Binary texture coordinates [21] are not affected by many of these symmetry transformations, and so a test requires textures containing at least three gray levels.For instance, reflecting a texture around the vertical axis has no effect on second-order statistics in the binary case, but it leads to a flip around the p 0 direction in the β +− "simple" plane in ternary texture space (dashed green line in Figure 4C; details in the Supplementary Information).We find that the distribution of natural images is symmetric about the p 0 direction and is thus unaffected by this transformation, predicting that psychophysical thresholds should also be unaffected when textures are flipped about the vertical axis.This is indeed the case (Figure 6B).Similarly, the natural image distribution is symmetric under flips about the horizontal axis, and also under rotations by 90, 180, and 270 degrees, predicting perceptual invariances that are borne out in the psychophysical data (Figure 6B).
Reflecting a texture about the vertical axis also has an interesting effect on the β + − plane: it not only flips the texture about the p 0 direction, but it also maps the texture onto the plane corresponding to the opposite diagonal orientation, β +

−
. The fact that a flip about the p 0 direction is a symmetry of natural images is thus related to the fact that the diagonal pairwise correlations are the same regardless of the orientation of the diagonal.This fact was already observed in the binary analysis [21], and is related to the invariance under 90-degree rotations observed here (Figure 6B).
It is important to note that these symmetries were not guaranteed to exist for either natural images or human psychophysics.Most of the textures that we are using are not themselves invariant under rotations (see the examples from Figures 1C, D).This means that invariances of predicted thresholds arise from symmetries in the overall shape of the distribution of natural textures.Similarly, had observed thresholds been unrelated to natural texture statistics, we could have found a discrepancy between the symmetries observed in natural images and those observed in human perception.As an example, the up and down directions differ in meaning, as do vertical and horizontal directions.A system that preserves these semantic differences would not be invariant under flips and rotations.The fact that the psychophysical thresholds are, in fact, invariant under precisely those transformations that leave the natural image distribution unchanged supports the idea that this is an adaptation to symmetries present in the natural visual world.
is reflected in the anatomy and physiology of visual circuits, and in visual behavior [5,22,26,27,28,29,30].Our psychophysical data also shows a bright/dark asymmetry.For instance, in Figure 4C, the threshold contour is not symmetric under the exchange of black and white checks, which has the effect of reflecting thresholds about the upper-left axis in the β ++ plane (dashed green line in the  4C and 5) is approximately independent of the downsampling ratio N and patch size R used in preprocessing.The labels on the x-axis are in the format N × R, with the violin plot and label in blue representing the analysis that we focused on in the rest of the paper.Each violin plot in the figure shows a kernel density estimate for the distribution of prediction errors for the 311 second-order single-and mixed-plane threshold measurements available in the psychophysics.The boxes show the 25th and 75th percentiles, and the lines indicate the medians.B. Relative change of predicted (blue) or measured (red) threshold following a symmetry transformation.This is defined as the difference divided by the average of the threshold values before and after the transformation (see Methods).Symmetry transformations that leave the natural image predictions unchanged also leave the psychophysical measurements unchanged.(See text for the special case of the exch(B,W) transformation.)The visualization style is the same as in panel A, except boxes and medians are not shown.The transformations starting with exch correspond to exchanges between gray levels; e.g., exch(B,W) exchanges black and white.lrFlip and udFlip are left-right and up-down geometric flips, respectively, while rot90 and rot180 are geometric rotations by the respective number of degrees (clockwise).
figure).Such bright-dark asymmetries lead to a wide distribution of relative changes in detection threshold upon the exchange of black and white (red violin plot in Figure 6B for the exch(B,W) transformation).Our natural image analysis does not show this asymmetry (blue violin plot in Figure 6B for the exch(B,W) transformation) because our preprocessing follows previous work [21] in taking the logarithm of the intensity values, which removes the bright-dark asymmetry that arises fundamentally from the lognormal distribution of light intensities [5] (also see footnote 2).

Discussion
The efficient coding hypothesis posits that sensory systems are adapted to maximize information about natural sensory stimuli.In this work, we provided a rigorous quantitative test of this hypothesis in the context of visual processing of textures in a regime dominated by sampling noise.To this end, we extended the study of binary texture perception to grayscale images that capture a broader range of correlations to which the brain could conceivably adapt.We first generalized the definition of textures based on local multi-point correlations to accommodate multiple luminance levels.We then constructed algorithms for generating these textures, and we used these in our behavioral studies.By separately analyzing the distribution of textures across an ensemble of natural images, we showed that psychophysical thresholds can be predicted in remarkable detail based on the statistics of natural scenes.By further exploiting symmetry transformations that have non-trivial effects on ternary (but not binary) texture statistics, we provided a novel test of efficient coding and therein demonstrated that visually-guided behavior shows the same invariances as the distribution of natural textures.Overall, this work strengthens and refines the idea that the brain is adapted to efficiently encode visual texture information.
The methodology developed here can be used to address many hypotheses about visual perception.For example, if a specific set of textures was hypothesized to be particularly ethologically relevant, this set could be measured and compared against "irrelevant" textures of equal signal-to-noise ratio.Because our hypothesis treats every dimension of texture space equally-the symmetry only broken by properties of the natural environment-we leveraged the rapidly increasing dimensionality of grayscale texture space to more stringently test the efficient coding hypothesis.In this vein, our construction can be generalized to larger numbers of gray levels and correlations over greater distances.However, the ability of neural systems to adapt to such correlations must ultimately be limited because, as texture complexity grows, it will eventually become impossible for the brain to collect sufficient statistics to determine optimal sensitivities.Even were it possible to accumulate these statistics, adapting to them might not be worth the computational cost of detecting and processing long-range correlations between many intensity values.Understanding the limits of texture adaptation will teach us about the cost-benefit tradeoffs of efficient coding in sensory cortex, in analogy with recently identified cost-benefit tradeoffs in optimal inference [35].And indeed, although our predictions are in excellent agreement with the data in most cases, we find a few systematic differences that may already be giving us a glimpse of these limits.
Definition of texture space A texture is defined here by the statistical properties of 2 × 2 blocks of checks, each of which takes the value 0, 1, or 2, corresponding to the 3 luminance levels (black, gray, or white; see Supplementary Information for a generalization to more gray levels).The 3 4 = 81 probabilities for all the possible configurations of such blocks form an overcomplete coordinate system because the statistical properties of textures are independent of position.To build a non-redundant parametrization of texture space, we use a construction based on a discrete Fourier transform (see Supplementary Information).Starting with the luminance values A i , i = 1, . . ., 4, of checks in a 2 × 2 texture block (arranged as in Figure 1A), we define the coordinates σ s1s2 s3s4 (h) which are equal to the fraction of locations where the linear combination remainder equal to h after division by three (the number of gray levels).In the case of three gray levels, the coefficients s i can be +1, −1, or 0.
Each set of coefficients s i identifies a texture group, and within each texture group we have three probability values, one for each value of h.Since the probabilities sum up to 1, each texture group can be represented as a plane, and more specifically, as a triangle in a plane, since the probabilities are also non-negative.This is the representation shown in Figure 1C, D and used in subsequent figures.For compactness of notation, when referring to the coefficients s i , we write + and − instead of +1 and −1, and omit coefficients that are 0, e.g., σ +− − instead of σ +1−1 0 −1 .We also use γ (rather than the generic symbol σ) for 1-point correlations, β for 2-point correlations, θ for 3-point correlations, and α for 4-point correlation, matching the notation used in the binary case [21,32].For instance, β + − is the plane identified by the linear combination A 1 − A 3 (mod 3).
Texture analysis and synthesis Finding the location in texture space that matches the statistics of a given image patch is straightforward given the definition above: we simply glide a 2×2 block4 over the image patch and count the fraction of locations where the combination s 1 A 1 +s 2 A 2 +s 3 A 3 +s 4 A 4 takes each of its possible values modulo three, for each texture group identified by the coefficients s i .
In order to generate a patch that corresponds to a given location in texture space, we use a maximum entropy construction that is an extension of the methods from [32].There are efficient algorithms based on 2d Markov models that can generate all single-group textures, namely, textures in which only the probabilities within a single texture group deviate from (1/3, 1/3, 1/3).For textures involving several groups, the construction is more involved, and in fact some combinations of texture coordinates cannot be achieved in a real texture. 5Details are provided in the Supplementary Information.
Visual stimulus design The psychophysical task is adapted from [24], and requires that the subject identify the location of a 16 × 64-check target within a 64 × 64-check array.The target is positioned near one of the four sides of the square array (chosen at random), with an 8-check margin.Target and background are distinguished by the texture used to color the checks: one is always the i.i.d.texture with 3 gray levels; the other is a texture specified by one or two of the coordinates defined in the text.In half of the trials, the target is structured and the background is i.i.d.; in the other half of the trials, the target is i.i.d. and the background is structured.To determine psychophysical sensitivity in a specific direction in the space of image statistics, we proceed as follows [21,32,33,34].We measure subject performance in this 4-alternative forced-choice task across a range of "texture contrasts", i.e., distances from the origin in the direction of interest.Fraction correct, as a function of texture contrast, is fit to a Weibull function, and threshold is taken as the texture contrast corresponding to a fraction correct of 0.625, i.e., halfway between chance (0.25) and ceiling (1.0).Typically, 12 different directions in one plane of stimulus space are studied in a randomly interleaved fashion.Each of these 12 directions is sampled at 3 values of texture contrast, chosen in pilot experiments to yield performance between chance and ceiling.
These trials are organized into 15 blocks of 288 trials each (a total of 4320 trials), so that each direction is sampled 360 times.
Visual stimulus display Stimuli, as described above, were presented on a mean-gray background for 120 ms, followed by a mask consisting of an array of i.i.d.checks, each half the size of the stimulus checks.The display size was 15 × 15 deg; viewing distance was 103 cm.Each of the 64 × 64 array stimulus checks consisted of 10 × 10 hardware pixels, and measured 14 × 14 min.The display device was an LCD monitor with a refresh rate of 100 Hz, driven by a Cambridge Research ViSaGe system.The monitor was calibrated with a photometer prior to each day of data collection to ensure that the luminance of the gray checks was halfway between that of the black checks (< 0.1 cd/m 2 ) and white checks (23 cd/m 2 ).
Psychophysics subjects Subjects were normal volunteers (3 male, 3 female), ages 20 to 57, with visual acuities, corrected if necessary, of 20/20 or better.Of the 6 subjects, MC is an experienced psychophysical observer with thousands of hours of experience; the other subjects (SR, NM, WC, ZA, JWB) had approximately 10 (JWB), 40 (NM, WC, ZA) or 100 (SR) hours of experience at the start of the study, as subjects in related experiments.MC is an author.NM, WC, and ZA were naïve to the purposes of the experiment.
This work was carried out with the subjects' informed consent, and in accordance with the Code of Ethics of the World Medical Association (Declaration of Helsinki) and the approval of the Institutional Review Board of Weill Cornell.

Psychophysics averaging
The average thresholds used in the main text were calculated by using the geometric mean of the subject thresholds, after applying a per-subject scaling factor chosen to best align the overall sensitivities of all the subjects; these multipliers ranged from 0.855 to 1.15.Rescaling a single consensus set of thresholds in this fashion accounted for 98.8% of the variance of individual thresholds across subjects.The average error bars were calculated by taking the root-mean-squared of the per-subject error bars in log space (determined from a bootstrap resampling of the Weibull-function fits, as in [24]), and then exponentiating.

Whitening of natural image patches
To generate the whitening filter that we used to remove average pairwise correlations, we started with the same preprocessing steps as for the texture analysis, up to and including the splitting into non-overlapping patches (first three steps in Figure 3A).We then took the average over all the patches of the power spectrum, which was obtained by taking the magnitude-squared of the 2d Fourier transform.Taking the reciprocal square root of each value in the resulting matrix yielded the Fourier transform of the filtering matrix.

Removal of blurred patches in natural images
Following the procedure from [21], we fit a Gaussian mixture model with non-shared covariance matrices to the distribution of natural images in order to identify patches that are out of focus or motion blurred.This assigned each image patch to one of two multivariate Gaussian distributions.To identify which mixture component contained the sharper patches, we chose the component that had the higher median value of a measure of sharpness based on a Laplacian filter.Specifically, each patch was normalized so that its median luminance was set to 1, then convolved with the matrix . The sharpness of the patch was calculated as the median absolute value over the pixels of the convolution result.This analysis was performed before any of the preprocessing steps, including the transformation to log intensities, and was restricted to the pixels that did not border image edges.There was thus no need to make assumptions regarding pixel values outside images.
Efficient coding calculations Threshold predictions from natural image statistics were obtained as in [21].We fit a multivariate Gaussian to the distribution of texture patches after removing the blurry component, and used the inverse of the standard deviation in the texture direction of interest as a prediction for the psychophysical threshold in that direction.The overall scale of the predictions is not fixed by this procedure.We chose the scaling so as to minimize the error between the n measurements x i and the predictions y i , min , where i are the measurement uncertainties in log space.This scaling factor was our single fitting parameter.
Calculating mismatch In Figure 6 we show several comparisons of two sets of thresholds x i and y i .These are either the set of measured thresholds and the set of natural image predictions for specific preprocessing options; or sets of either measured or predicted thresholds before and after the action of a symmetry transformation.The measure of relative error or change that we used in these cases is given by 2(y i − x i )/(y i + x i ).In panel A of the figure all 311 measured values and the corresponding predictions were used.For panel B, this set was restricted in two ways.First, for we ignored that measurements for which we did not have psychophysics data for the transformed direction.And second, we ignored directions on which the transformation acted trivially (see Supplementary Information).
This Supplement provides the details for the present parameterization of local image statistics.It generalizes the approach developed in [32] for binary images along the lines indicated in that manuscripts Appendix A, so that it is applicable to an arbitrary number G of gray levels.In the present study, G = 3, but the analysis is equally applicable to any prime value G, including the G = 2 case that has been the focus of previous work [32,33,34,36,37].When G is composite, the basic approach remains valid but, as mentioned below, there are some additional considerations.
We consider the statistics of a 2 × 2 neighborhood of checks in images with G gray levels.The starting point is an enumeration of the probabilities of each kind of 2 × 2 block, p , where each A k denotes the gray level of a check, which we denote by an integer from 0 to G − 1.There are G 4 such configurations, but the probabilities are not independent: they must sum to 1, and they must be stationary in space.For example, the probability of 1 × 2 blocks computed by marginalizing over the lower two checks must equal to the probability of 1 × 2 blocks computed by marginalizing over the upper two checks.
Our main goal is to obtain a coordinate system that removes these linear dependencies.The first step is to construct new coordinates ϕ s 1 s 2 s 3 s 4 by discrete Fourier transformation with respect to the gray level value in each check.As this is a discrete transform, the arguments s k are also integers from 0 to G − 1: The original block probabilities p A 1 A 2 A 3 A 4 can be obtained from the Fourier transform coordinates (eq.( 1)) by standard inversion: Fourier transform coordinates can be similarly described for any configuration of checks, including subsets of the 2 × 2 neighborhood.A basic property of the Fourier transform coordinates is that setting an argument to zero corresponds to marginalizing over the corresponding check.For example, consider the probabilities of the configurations of the upper 1 × 2 block of checks, p A 1 A 2 , which are determined by marginalizing p A 1 A 2 A 3 A 4 over A 3 and A 4 .Their Fourier transform coordinates are given by It follows from eq. ( 1) that Thus, the stationarity condition is equivalent to Similarly, the stationarity condition for 2 × 1 blocks is equivalent to the condition that the single-check probabilities are equal in all four positions is equivalent to and the condition that the sum of all block probabilities is 1 is equivalent to In sum, the stationarity conditions can be stated in terms of the Fourier transform coordinates as follows: if any of the arguments of ϕ s 1 s 2 s 3 s 4 are zero, then they can be replaced by empty spaces, and the value of ϕ s 1 s 2 s 3 s 4 must be unchanged by translating the nonzero values within the 2 × 2 neighborhood.It follows that the Fourier transform coordinates of a stationary distribution are specified by: ϕ s , equal to the common value of the four expressions in eq. ( 8); ϕ s 1 s 2 , equal to the common value of the two expressions in eq. ( 6); ϕ s 1 s 3 , equal to the common value of the two expressions in eq. ( 7 .In all of these cases, the arguments s k are nonzero.Thus, the total number of parameters, obtained by allowing each of the s k to range from ; this is 10 for G = 2 and 66 for G = 3.The Fourier transform coordinates incorporate the stationarity constraints, and they also have the convenient property that the origin of the space, i.e., the image whose coordinates are all zero, is an image with identically-distributed gray levels in which every block probability p A 1 A 2 A 3 A 4 is equal to 1/G 4 .The Fourier transform coordinates have another convenient property (using the approach of Appendix B of [32]): near the origin of the space, entropy is proportional to the square of the Euclidean distance from the origin.This means that the Fourier transform coordinates are "calibrated": for an ideal observer, small deviations in any direction from the origin are equally discriminable.
However, since for G > 2, the Fourier transform coordinates are complex numbers, an arbitrary choice of them will typically not correspond to a realizable set of block probabilities, since the block probabilities must be all real and in the range [0, 1].
To address this problem, we note a relationship among the Fourier transform coordinates, which, when G is prime, partitions the set of independent coordinates into disjoint subsets of size G − 1.A further linear transformation within this set yields real-valued coordinates, which correspond to the coordinate system used here (for G = 3) and in previous studies (for G = 2).
To derive these real-valued coordinates, we use modular arithmetic.When G is prime, for every integer q ∈ {1, . . ., G − 1} there is a unique integer r ∈ {1, . . ., G − 1} for which qr = 1 (mod G), which we denote q −1 .Thus, if S = s 1 s 2 s 3 s 4 can be obtained from S = s 1 s 2 s 3 s 4 by S = qS, then it follows that S can be obtained from S by S = q −1 S , i.e., the relationship is reciprocal.It also follows that every Fourier transform coordinate S is some scalar multiple of a "monic" Fourier transform coordinate, i.e., one whose first nonzero element is 1.The reason is that we can take the multiplier q to be the first nonzero coordinate of S and write S = q −1 S .Next, we note that all of the Fourier transform coordinates whose arguments are of the form qS have an exponential in eq. ( 1) that depends only on the value of This motivates grouping the terms of eq. ( 1) according to this value.We therefore define i.e., σ s1 s2 s3 s4 (h) is the sum of the probabilities of all blocks for which The monic σ's, i.e., the σ's whose first nonzero s k is equal to 1, are our desired real-valued coordinates.
As eq. ( 10) shows, σ s1 s2 s3 s4 (h) is the probability that a linear combination of gray levels whose coefficients are specified by the s k will result in a value of h.They are thus all in the range [0, 1], and their sum is 1.For G = 1, the pair σ(0) and σ(1) subject to σ(0) + σ(1) = 1 is a one-dimensional domain, parametrized by σ(1) − σ(0); other than a change in sign, these are the coordinates used in [32,33,34,36,37].For G = 3, as is the case here, the triplet σ(0), σ(1), and σ( 2) is subject to σ(0) + σ(1) + σ(2) = 1 and is naturally plotted in a triangular "alloy plot" with centroid at (1/3, 1/3, 1/3), the image with independent, identically-distributed gray levels.Note that 2 = −1 (mod 3), yielding the notation in the main text where the coefficients s i took values +1, −1, and 0 instead of 0, 1, and 2. It remains to show that all of the degrees of freedom in the Fourier Transform coordinates ϕ are captured by the σs.Since the Fourier transform coordinates are partitioned into disjoint subsets, it suffices to examine the transformation between each of these subsets (i.e., the Fourier transform coordinates that are scalar multiples of a particular monic S, and the corresponding σ).These subsets correspond to the "simple" planes introduced in the main text.It follows from eqns.( 1) and ( 10) that, for q = 0 (mod G), Via discrete Fourier inversion, this equation implies Note that the q = 0 term of this equation is given by eq. ( 9), the normalization condition.Thus, Equations ( 11) and ( 13) display the bidirectional transformation between the G-vector σ and the G − 1 Fourier transform coordinates qS.Since this transformation is a discrete Fourier transform (and hence, a multiple of a unitary transformation), it preserves the property that entropy is a proportional to the square of the Euclidean distance from the origin.When G is not prime, the decomposition of Fourier transform coordinates into disjoint sets indexed by monic coordinates is no longer possible.For example, with G = 4, both S = 1 0 0 0 and S = 1 2 2 0 are monic but the sets qS and qS have a non-empty intersection: 2S = 2S = 2 0 0 0 (mod 4).This necessitates a more elaborate version of the above approach, with separate strata for each factor of G.The disjoint sets of Fourier transform coordinates are no longer all of the same size, and the transformations ( 11) and ( 13) have a more elaborate form, although the overall parameter count is the same.As this case is not relevant to the present experiments, we do not discuss it further.

Texture synthesis
Creation of the stimuli used here requires synthesis of images whose statistics are specified by one or two of the coordinates described above.We adopted the strategy of [32], Table 2, for this purpose.(i) Coordinates that are of lower order than the specified coordinates are set to zero.The rationale is that sensitivity to lower-order coordinates is generally greater than sensitivity to higher-order coordinates, so this allows detection to be driven by the higher-order coordinates.(ii) Coordinates that are of higher order than the specified coordinates are chosen to achieve an image ensemble whose entropy is maximized.The rationale is that this sets the higher-order coordinates at the value that is implied by the lower-order coordinates, without any further spatial structure.(iii) Coordinates that are of the same order as the specified coordinates are chosen to satisfy the "Pickard rules" [38], as this allows for stimulus generation via a Markov process in the plane, and hence, maximizes entropy given the constraints of the specified textures.(iv) In a few cases (all involving third-order statistics), the specified parameters are inconsistent with the Pickard rules, and in these cases, specific choices of texture parameters are made to allow for convenient texture synthesis.In all cases in which the unspecified texture parameters are assigned a nonzero value, this nonzero value decreases to zero rapidly (at least quadratically) near the origin.Thus, the construction guarantees that the surface corresponding to any two specified texture coordinates is tangent to their coordinate plane at the origin.
In general, the above strategy also applies for G ≥ 3. We focus on specifying pairs of second-order coordinates, the stimuli used in this study.When the specified coordinates share the same linear combination (e.g., β 12 (0) and β 12 (1)) or when the two specified coordinates involve different linear combinations but the same checks (e.g., β 1 1 (0) and β 1 2 (0)), images may be synthesized by a Markov process that operates in the direction of the coupled checks.For example, if β 1s2 is specified, a Markov process is used to create each row.The Markov generation procedure guarantees that the image is a sample from a maximum-entropy ensemble consistent with the specified coordinates.It implicitly defines the other texture coordinates in a manner consistent with the above policies established for G = 2.
For combinations of coordinates involving non-identical pairs of checks (e.g., β 1s2 and β 1 s3 ), a new construction is needed in some cases.The basic issue is that a Markov process that generates the correlations along rows may be inconsistent with a Markov process that generates the columns.
To see how this can happen, consider β 11 (1) = 0 and β 1 2 (1) = 1.Taking into account stationarity, The inconsistency arises because the first set of equalities implies that A 2 = −A 1 and A 4 = −A 3 , so A 1 + 2A 3 = −(A 2 + 2A 4 ), which is inconsistent with the second set of equalities.The inconsistency can also be seen from an algebraic viewpoint.The horizontal correlation β 11 corresponds to a leftto-right Markov process that biases check pairs whose gray levels satisfy a multiplicative recurrence, x n+1 = 2x n .The vertical correlation β 1 2 corresponds to a top-to-bottom Markov process that biases check pairs whose gray levels satisfy an additive recurrence, x n+1 = x n − 1.The inconsistency arises because these transformations do not commute.
To handle these cases, we use the following construction.It produces samples from an image ensemble that match the specified second-order statistics, and for which all other second-order statistics, as well as first-and third-order statistics, are zero.As a first step, two textures are created: a Markov process along rows, providing for correlations of the form β 1s2 , and a Markov process along columns, providing for correlations of the form β 1

s3
. Then, taking inspiration from the "dead leaves" generative model of images [39], we randomly choose rows from the first texture and columns from the second texture and sequentially place them on the plane, occluding whatever has been placed earlier.Eventually, this "falling sticks" construction covers the plane, and this completes the next stage of the construction.
The resulting texture has the same kinds of correlations as the two starting textures, but the correlations are diluted, because a "stick" in one direction may be overlaid by an orthogonal stick placed at a later time.To calculate this dilution, we consider the three "sticks" that could contribute to a given 1 × 2 block of the final texture: one horizontal stick and two vertical sticks.There is a 1/3 chance that any of them is the one that is placed last.If the last stick is horizontal (which happens with probability 1/3), then the two checks of the 1 × 2 block reflect the correlation structure of the underlying texture.If the last stick is vertical (which happens with probability 2/3), then these two checks are uncorrelated, since they are derived from independent Markov processes.That is, Thus, to obtain a falling-sticks texture with a given set of correlations, one must choose Expressed in terms of distance from randomness, this demonstrates the threefold dilution: This limits the maximum correlation strength of the final texture, but it suffices for the present purposes since the achievable correlation strengths are generally far above perceptual threshold.A similar analysis applies to the vertical pairwise correlations.Note that first-order correlations are zero since the two starting textures had an equal number of checks of all gray levels, and third-order correlations within a 2 × 2 block are zero because they always involve checks that originated in independent Markov processes.Some fourth-order correlations are not zero, but their deviations from zero are small: this is because they arise from 2 × 2 neighborhoods in which the two last "sticks" are both horizontal (1/6 of the time) or both vertical (1/6 of the time), and these numerical factors multiply a product of two terms involving Finally, a Metropolis mixing step [40] is applied, to maximize entropy without changing the 2 × 2 block probabilities (see [32] for details).This eliminates any spurious long-range correlations that may have arisen from the "sticks" of the underlying textures.

Symmetry tests
In order to test to what extent the natural image predictions or the psychophysical measurements are invariant under symmetry transformations, we need to understand the effect of such transformations on texture coordinates σ s1s2 s3s4 .Two observations are key.First, every geometric transformation we are interested in-reflections and rotations by multiples of 90 • -correspond to permutations of the check locations A 1 , A 2 , A 3 , A 4 .For instance, a horizontal flip exchanges A 1 with A 2 and A 3 with A 4 .Second, for the particular case of ternary textures, all the permutations of the 3 gray levels correspond to affine transformations modulo 3. Specifically, given a check value A, consider the transformation A → xA + y (mod 3).(x, y) = (1, 0) is the identity; (x, y) = (1, 1) and (x, y) = (1, 2) are the non-trivial cyclic permutations; and x = 2, y ∈ {0, 1, 2} yields the three pairwise exchanges.
We exclude x = 0 since this would correspond to removing all luminance variations in the image patches.
As we now show, the net result of a geometric transformation and a color permutation always corresponds to a permutation of the texture coordinates.Consider a general permutation ρ −1 on the four check locations, A k → A ρ −1 (k) (it will become clear below why we use the inverse here), and a general affine transformation on the gray levels, A → xA + y (mod G), with x = 0.The equation appearing in the definition of the σ s1s2 s3s4 (h) direction (eq.( 10)) becomes: Note that although it has the same range of values, h here is a label identifying the coordinate direction, and is thus not transformed by the affine transformation applied to the luminance values A k .Using x = 0, we find Thus, the effect of the transformation was to convert the original texture direction into a different one.To properly identify the transformed direction, we need to put it in monic form; that is, we need to ensure that the first non-zero coefficient is set to 1. Suppose that this coefficient appears at position k 0 , and is equal to s ρ(k0) .We can write: and therefore sk0 = 1.Thus the direction σ s1s2 s3s4 (h) gets mapped to σ s1 s2 s3 s4 (αh − β (mod G)) where α = s −1 ρ(k0) x −1 and β = αy s k .Thus, all transformations correspond to relabeling of the texture coordinates.This approach holds for any prime G, but for G > 3 the affine transformations will no longer be sufficient to model all gray level permutations.
To find the effect of the geometric and gray-level transformations on the theoretical predictions, we apply this reshuffling to the columns of the N patches × 99 matrix giving the distribution of natural image patches in texture space. 7We then recalculate the threshold predictions and check how much these changed.This is equivalent to first performing the geometric and gray level transformations directly on each image and then rerunning the whole analysis, but is substantially more efficient.
For the psychophysics, we apply the transformation to each direction in texture space for which we have thresholds.In some cases, the transformed direction is not contained in the experimental dataset; we cannot check for symmetry when this happens.We thus only compare the original and transformed thresholds in cases where the transformed direction maps onto one of the directions in the original dataset.
Table 1.Results from statistical tests comparing the match between measured and predicted thresholds to chance.The left column gives the preprocessing parameters N (the downsampling factor) and R (the patch size) in the format N × R. For each of the permutation tests, a p-value and the shortest interval containing 95% of the D values obtained in 10,000 samples is given (the 95% highest-density interval, or HDI).Similarly, for the exponent estimation, we include the shortest interval containing 95% of the posterior density for each of the two model parameters (the 95% highest posterior-density interval, or HPDI).Note that some symmetry transformations leave certain directions in texture space invariant.For instance, a left-right flip leaves the entire β 11 plane invariant since it only flips the order of the terms in the sum A 1 + A 2 .When this happens, the thresholds obtained in those directions are unaffected by the transformation and thus the fact that they do not change cannot be used as evidence that the symmetry is obeyed.For this reason, all invariant directions are ignored when looking at the effect of a transformation.This explains the variability in the number of points in the different plots from Figure 6B.

Statistical tests
We performed several statistical tests to assess the quality of the match that we found between measurements and natural image predictions.For all of the tests we used a scalar measure of the discrepancy that is given by the root-mean-square error calculated in log space, after accounting for a potential scaling factor.More precisely, suppose we have n measurements x i and n predictions y i .We define the mean-centered log thresholds where .represents the mean over all measurement directions.Then the mismatch between x and y is given by Thus, when D is small, it is a measure of the average relative error between measurements and predictions.
1. Permutation test over all thresholds.This test is meant to check how likely it is that the observed value of the difference D could have been obtained by chance in a model in which all the measured thresholds x i are drawn independently from a common random distribution.We generated 10,000 random permutations of the dataset x i , x µ i (each of which containing 311 data points in 4 single and 22 mixed planes), and for each of these calculated the difference D µ between the observed values and the predictions y i .We then calculated the fraction of samples µ for which the difference was smaller than the observed one, D µ ≤ D, which is an estimate of the p-value.

2.
Permutation test preserving ellipticity.The naïve permutation test above generates independent thresholds even for directions that are nearby within a given texture plane.To build a more stringent test where the threshold contours are kept close to elliptical, we used a different sampling procedure where permutations were applied only within texture groups, and were forced to be cyclic.In this way, thresholds obtained for adjacent texture directions were kept adjacent to each other, preserving the correlations implied by the elliptical contours.More specifically, assume that we index the n groups texture groups for which we have data by σ, and let x σ be the subset of elements of x corresponding to group σ.Also let R be the shift operator that circularly permutes the elements in a vector to the right, such that the first element becomes the second, the second becomes the third and so on, with the last element being moved to the first position.For each resampling of the measurements x, we sampled n groups non-negative integers k σ and performed the transformations x σ → R kσ x σ .The largest value for k σ was chosen to be equal to the number of elements in x σ .For each of the 10,000 samples obtained in this way we calculated the D statistic and proceeded as above to get a p-value.
3. Exponent estimation.The predictions from natural image statistics were obtained by taking the inverse of the standard deviation of the natural texture distribution in each direction.This differs by a square root from the efficient-coding prediction for Gaussian inputs and linear gain [21].This is not unreasonable since natural scene statistics are not exactly Gaussian, and we do not expect brain processing to be precisely linear.However, to more fully investigate possible non-linearities, we considered general power-law transformations of the predicted thresholds, and used the data to estimate the exponent β.Specifically, given the mean-centered log predictions ŷi , we asked whether β ŷi is a better approximation to the measurements xi (this implies that y β i provides a better prediction for the x i values, which is why we refer to β as an exponent).We can write down the model where i are errors drawn from a standard normal distribution, i ∼ N (0, 1).This model interpolates between the null model above that assumes all thresholds are drawn from the same distribution (when the exponent β = 0), and a model in which they are given by the values predicted from natural images, plus noise (with exponent β = 1).To find β and σ, we used a Bayesian approach.The log posterior distribution for the parameters β and σ given For each value of the fraction of gray checks, we recalculated the threshold predictions and compared them to the psychophysical measurements.Each violin in the figure shows a kernel density estimate for the distribution of prediction errors for the 311 second-order single-and mixed-plane threshold measurements available in the psychophysics.We see that the precise thresholds used for ternarization do not significantly affect the match between natural image predictions and psychophysics.The lowest error is close to the value 1/3 which corresponds to equal fractions of black, gray, and white checks, and is the one used in the main text.The corresponding violin is highlighted in blue in the figure.
where n is the number of measurements, and we assumed that β and σ are independent in our prior distribution.We then used slice sampling (taking advantage of the slicesample function in Matlab) to draw from the posterior distribution.We used 10,000 samples in total, and we discarded the first 5,000 as a burn-in period.We used a flat prior for β and log σ, but checked that the results are qualitatively the same when using other priors.
The results from these statistical tests are summarized in Table 1 for the various choices of downsampling factor N and patch size R, and they suggest that the match we see between the psychophysics and the natural image predictions is not a fluke.Interestingly, the 95% credible intervals obtained for the exponent β in the exponent-estimation model does not include 1 for most choices of preprocessing parameters, suggesting that an additional nonlinearity is at play here.

Robustness tests
The match between psychophysical thresholds and efficient coding predictions is robust under a number of alterations in the analysis pipeline, including changing the parameters of the preprocessing and using different image databases.
Changing preprocessing parameters As we showed in the main text, changing the patch size R or the downsampling ratio N does not significantly affect the match between experiment and Table 2. Results from statistical tests comparing the match between measured and predicted thresholds to chance when using the van Hateren natural image database [41].The left column gives the preprocessing parameters N (the downsampling factor) and R (the patch size) in the format N × R. For each of the permutation tests, a p-value and the shortest interval containing 95% of the D values obtained in 10,000 samples is given (the 95% highest-density interval, or HDI).Similarly, for the exponent estimation, we include the shortest interval containing 95% of the posterior density for each of the two model parameters (the 95% highest posterior-density interval, or HPDI).theory.Another aspect of the preprocessing that we have varied is the ternarization procedure.
In the main text, images were ternarized by splitting the entire dynamic range of each patch into three regions, each corresponding to an equal number of checks. 8We can instead parametrize the ternarization by the fraction ρ of checks that are mapped to gray, while assuming that the remaining 1 − ρ checks are equally distributed between black and white.Thus, the default ternarization procedure corresponds to ρ = 1/3.The effects of varying ρ are small in most texture planes, with an increase in prediction error as we move away from histogram equalization (ρ = 1/3), as seen in Figure 7.
Changing the image database The accuracy of the natural image threshold predictions is also good when we use different image databases.Figure 8 shows the match between predictions and measurements in each plane when using the van Hateren database [41] with a downsampling ratio N = 2 and patch size R = 32.The distance measure from eq. ( 22) comparing these results to the results obtained from the Penn Image Database using the same preprocessing options was D Penn-vH = 0.0815, showing that the two sets of measurements not only both agree with the psychophysics, but also agree with each other.Table 2 shows the results of the statistical tests for various preprocessing parameters for the van Hateren database.
Subject dependence As mentioned in the main text, the psychophysical thresholds show remarkable consistency across subjects, with most differences attributable to an overall scaling factor.The results are shown in Figure 9.
The differences between different subjects were more pronounced in higher-order planes (Figure 10).Note that the predicted thresholds (shown as blue dots in the figure) are still not far from the measurements; in particular, the predictions reflect the fact that the thresholds in the higher-order planes are generally high. .Psychophysical thresholds in higher-order planes for individual subjects (crosses).The natural image predictions are also shown, in blue dots.The notations are as in the main text. in many directions, performance did not sufficiently exceed chance to allow for a reliable determination of threshold; in these cases, data points are omitted.

Figure 1 .
Figure 1.Ternary texture analysis.A. With three luminance levels there are 3 4 = 81 possible check configurations for a 2 × 2 block (histogram on the right).We parametrize the pairwise correlations within these blocks using modular sums or differences of luminance values at nearby locations, mod(A ± B, 3) (see Methods and Supplement for details).This notation denotes the remainder after division by 3, so that for example mod(4, 3) = 1 and mod(−1, 3) = 2.The texture coordinates are defined by the probabilities p0, p1, p2 with which mod(A ± B, 3) equals its three possible values, 0, 1, or 2. These probabilities sum to 1, so there are only two independent coordinates.B. The eight second-order groups (planes) of texture coordinates in the ternary case.Each choice of orientation of the pair of checks for which the correlation is calculated, and whether a sum or a difference of luminance values is used, identifies a texture group.The greek letter notation (β for the second-order planes) mirrors the notation used in[21].C. and D. Example texture groups ("simple" planes).The origin is the point p0 = p1 = p2 = 1/3, representing an unbiased random texture.The interior of the triangle shows the allowed range in the plane where all the probability values are non-negative.The vertices are the points where only one of the probabilities is nonzero.An example texture patch is shown for the origin, as well as for each of the vertices of the probability space.

Figure 3 .
Figure 3. Preprocessing of natural images.A. Images (which use a logarithmic encoding for luminance) are first downsampled by a factor N and split into square patches of size R.The ensemble of patches is whitened by applying a filter that removes the average pairwise correlations (see panel C), and finally ternarized after histogram equalization (see panel D).B. Blurry images are identified by fitting a two-component Gaussian mixture to the full distribution of image textures.This is shown here in a particular projection involving a second-order direction (β+−) and a fourth-order one (α +− +−

Figure 4 .
Figure 4. Experimental setup and results in second-order simple planes.A. Psychophysical trials used a four-alternative forced-choice task in which the subjects identified the location of a strip sampled from a different texture on top of a background texture.B. The subject's performance in terms of fraction of correct answers was fit with a Weibull function and the threshold was identified at the mid-point between chance and perfect performance.Note that if the subject's performance never reaches the mid-point on any of the trials, this procedure may extrapolate a threshold that falls outside the valid range for the coordinate system (see, e.g., the points outside the triangles in panel C).This signifies a low-sensitivity direction of texture space.C. Measured (red crosses with pink error bars; the error bars are in most cases smaller than the symbol sizes) and predicted (blue dots) thresholds in second-order simple planes.Thresholds were predicted to be inversely proportional to the standard deviation observed in each texture direction in natural images.The plotted results used downsampling factor N = 2 and patch size R = 32.A single scaling factor for all planes was used to match to the psychophysics.The orange and green dotted lines show the effect of two symmetry transformations on the texture statistics (see text).

Figure 7 .
Figure 7. Robustness to changing ternarization thresholds.We varied the fraction of gray checks in the ternarized natural image patches, while keeping the fractions of black and white checks equal to each other.For each value of the fraction of gray checks, we recalculated the threshold predictions and compared them to the psychophysical measurements.Each violin in the figure shows a kernel density estimate for the distribution of prediction errors for the 311 second-order single-and mixed-plane threshold measurements available in the psychophysics.We see that the precise thresholds used for ternarization do not significantly affect the match between natural image predictions and psychophysics.The lowest error is close to the value 1/3 which corresponds to equal fractions of black, gray, and white checks, and is the one used in the main text.The corresponding violin is highlighted in blue in the figure.

Figure 10
Figure 10.Psychophysical thresholds in higher-order planes for individual subjects (crosses).The natural image predictions are also shown, in blue dots.The notations are as in the main text. in many directions, performance did not sufficiently exceed chance to allow for a reliable determination of threshold; in these cases, data points are omitted.
Robustness of results and effects of symmetry transformations.A. The relative error (calculated as difference divided by the average; see Methods) between the measured and predicted thresholds (red crosses and blue dots, respectively, in Figures