{'fraction_non_alphanumeric': 0.03216259981015132, 'fraction_numerical': 0.01331732648389078, 'mean_word_length': 4.467714852694245, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
On the Power Spectral Density Applied to the Analysis of Old Canvases

A routine task for art historians is painting diagnostics, such as dating or attribution. Signal processing of the X-ray image of a canvas provides useful information about its fabric. However, previous methods may fail when very old and deteriorated artworks or simply canvases of small size are studied. We present a new framework to analyze and further characterize the paintings from their radiographs. First, we start from a general analysis of lattices and provide new unifying results about the theoretical spectra of weaves. Then, we use these results to infer the main structure of the fabric, like the type of weave and the thread densities. We propose a practical estimation of these theoretical results from paintings with the averaged power spectral density (PSD), which provides a more robust tool. Furthermore, we found that the PSD provides a fingerprint that characterizes the whole canvas. We search and discuss some distinctive features we may find in that fingerprint. We apply these results to several masterpieces of the 17th and 18th centuries from the Museo Nacional del Prado to show that this approach yields accurate results in thread counting and is very useful for paintings comparison, even in situations where previous methods fail.


Introduction
Lately there has been a wider interest on acquiring and processing artwork image data, thanks to the greater computing capabilities and digital storage. Advances in technology for image data acquisition and the wide range of imaging modalities currently available have made that museums assemble vast digital libraries of images of their collections, not only for archiving but also for analyzing their pieces of art [1]. Moreover, an increasing number of scientists have approached this field to apply digital image processing and data analysis techniques. These techniques have been proved useful for many crucial issues in artwork diagnostics, such as assessment of the conservation state, knowledge of the realization techniques, evaluation of the historical period and attribution of the painting, and the possibility of keeping trace of any modification of the artwork shape [2]. Therefore, interdisciplinary interaction between art historians and signal processing researchers is of greatest interest to elaborate image analysis tools that help to make repeatable automatic procedures and diagnostics on paintings [3]- [5].
Traditionally, one of the most common canvas analyses is based on X-ray images of paintings. The canvas fabric is initially coated with a priming substance, which generally contains lead. This ground layer varies in thickness according to the weave threads of the canvas, affecting the X-ray absorption. This makes the fabric pattern be showed in radiographies of the painting [6]. Until a few years ago, art experts used X-rays to analyze only the composition of the visible and hidden paint layers on the canvas. More recently, however, researchers have realized that the threads pattern may carry also important art-historical information [7].
The first pattern measurement to be used was the thread densities [8], [9]. These densities are not specific to each artwork, but characterize the roll from which the canvas was cut. Specifically, the weaving process itself results in the thread densities showing striped arrangements, in the direction of both warp (corresponding to the length of the roll placed on the loom) and weft (corresponding to the width of the roll) [10]. Thus, matching of the densities maps of two paintings makes it possible to identify aligned pieces of canvas from the same original roll, which is a strong indication that these two paintings were made in both the same workshop and period. Further researches include threads angles [11], [12], since they provide information about the phenomenon known as cusping, i.e., the displacement of the threads from a rectilinear pattern caused by attaching the canvas to a stretcher with tacks before priming the surface. More recently, more complicated weave patterns, like twills, have also been studied [13].
Most of previous studies have used two-dimensional discrete Fourier transforms (2-D DFTs) to develop computerassisted tools for analyzing canvas weaves [8]- [17]. To summarize, the locations of spectral peaks on the horizontal and vertical axes of the 2-D DFT correspond to the thread densities. In addition, thread tilting from alignment to the axes of the canvas leads to a corresponding rotation of the spectrum. This procedure is performed on a small piece of fabric and repeated until the whole canvas is analyzed, giving maps of local densities and angles for the entire painting.
Other recent research has explored techniques that are more sophisticated, such as autocorrelation and pattern recognition algorithms [18], synchrosqueezed transforms [6] or machine learning models [7]. They try to develop maps of thread patterns that are more detailed. Once the paintings thread maps have been created, we need a method to relate them and help matching paintings. The customary way to do that makes use of two steps. The first one is a comparison of some feature of the weave, such as the mode or mean of the frequencies of the threads. Provided a similarity is found, the second step is to compare some appropriate features, such as the averaged densities [12], average density deviations [13] or the histograms of the cross-correlations [17].
All these methods have proved successful when applied to artworks of Vincent van Gogh, Johannes Vermeer or Diego Velázquez. Nevertheless, they show a poor performance when applied to some other paintings, especially to deteriorated ones. In these ones, fabric is much more irregular and usually exhibits larger twisting due to frames or seams. Also, part of the original canvas may be missing or primer can be thick enough to not let some threads be distinguishable in the X-ray. Therefore, a mere thread count may not provide any consistent result. In addition, thread charts are useful when matching two adjacent canvas but much less appropriate when they come from slices apart in their roll. In particular, if we are dealing with small canvases the probability that they are contiguous pieces of fabric is fewer.
In this paper, we propose a different approach. Rather than finding an extremely exhaustive thread map, we search for a canvas fingerprint that characterizes the whole roll and even the production process. This fingerprint allows to deal with fabrics with more sophisticated patterns.
To characterize the painting, we roughly follow the model proposed in [19], which uses Fourier analysis like the aforementioned papers but from a different point of view. Instead of locating the greatest spectral peak on the horizontal and vertical axes, a wider collection of maxima is found. In this paper we also do that, but the position of these maxima is selected according to a thorough theoretical study that we derive from lattices and apply to weave patterns. In addition, instead of divide the canvas into small pieces and perform the analysis for each one independently, we average the maxima for the entire painting.
Furthermore, we propose to calculate an estimation of the power spectral density (PSD) instead of simply perform a DFT, since it is more appropriate to deal with random signals [20]. More precisely, an averaged periodogram proves a suitable choice. We find that the position of the averaged maxima of the spectral density follows a pattern that is strictly related to the fabric structure. Accordingly, we extract a set of parameters who completely characterize the canvas. This is a fingerprint that keeps quite stable provided the manufacturing technique does not change. This novel method exhibits promising results in paintings by Goya, Velázquez or Rivera.
From the above discussion, the contribution of this paper is threefold. The first one is of theoretical kind. We prove that the Fourier transform of a 2-dimensional periodic structure, such a weave, has a triangular shaped repetitive pattern and we fully characterize it. Up to our knowledge, there is only some rough, not rigorous results about this issue in the literature [19]. The two other contributions of our paper are of practical nature. On the one hand, our PSD method yields some features that help us to characterize the canvases so that an accurate comparison between them is possible, with better results than previous techniques. On the other hand, this PSD analysis will serve also as a counting method, providing reliable results even in situations where the standard DFT-based count fails. Actually, our method has already proven useful in the research at the Museo Nacional del Prado [21].

Standard DFT method for thread counting
The simplest yet most widely used method for canvas analysis is thread counting. The vertical threads mounted in a loom are called the warp while the horizontal strands are known as the weft. However, the warp and the weft may be associated to either the vertical or the horizontal fibers in the canvas because the artist places the piece of weave on the stretcher in any position.
Thread count data is commonly employed as evidence for dating and attribution of paintings [9]. The horizontal and vertical thread count statistics provides information about the roll from which it was cut. If the statistics of two canvases disagree (even when allowing for rotation), then they most likely have a different origin, whereas if they agree to some tolerance level they could have been cut from the same roll. This helps the art historian to conclude whether two paintings are contemporary with each other [12].
Manual thread counting is a very tedious process. In addition, the strands do not run in precise straight lines and this makes a human measurement difficult. By using signal processing techniques, the hope is to develop algorithms that simplify and enhance manual measurements, allowing a more detailed analysis of paintings.
The standard method to perform an automatic counting lies on the hypothesis that the threads follow an approximately periodic pattern. This pattern may be supposed to follow a sinusoidal model [8], [9] or other shapes like rectangles [13]. In any case, it is assumed that both horizontal and vertical strands have a fundamental frequency of repetition. For that reason, the core of the standard thread counting algorithm is a discrete Fourier transform (DFT).
More precisely, the X-ray image of the canvas is windowed into small swatches (squares of side about 1 cm) and its two-dimensional DFT is computed. To obtain spectral details, the Fourier transform size is much larger than the windowed section. Ignoring the lowest spectral components, which are due to the prevalent grey-colored tones in the painting, several dominant peaks appears in the DFT. However, thanks to the real nature of numbers representing the image, the spectrum is symmetrical. Then, only half of these peaks are distinct. In particular, for a plain-weave the dominant peak in the x-axis (vertical threads frequency) corresponds to the vertical threads counting while the main peak in the y-axis (horizontal threads frequency) belongs to the horizontal threads counting.
Furthermore, there is no guarantee that the weave will align with the x and y axes, due to fabric imperfections or mounting artefacts such as canvas stretch. This effect will appear in the DFT as a rotation of the spectral peaks by the same angles as the warp and weft. Therefore, we can also measure the angular deviations of the peaks from the axes since they can provide useful information about the canvas.
Then, we compute another swatch shifted in possibly both horizontal and vertical directions. In addition, adjacent swatches are usually overlapped. The process is repeated until the whole canvas is analyzed. Finally, some useful graphs and statistics can be carried out.
As an example of the usefulness of this method, let us compare two paintings by José de Ribera. They are known with certainty to be made at the same time. We can first compare the histograms for both the horizontal and vertical thread countings. They can be seen in Fig. 1(a) and Fig. 1(b) and its resemblance is undoubted, especially in the vertical histogram. In addition, Table 1 presents some important statistical parameters (mode, mean and standard deviation) of the measurement. The resemblance is again quite remarkable, what confirms that the origin of both paintings must be the same roll of fabric.
Despite the usefulness of this method, in some scenarios it may produce misleading results. For instance, let us analyze two paintings attributed to Miguel de Pret. Their histograms are presented in Fig. 2. Besides, we have the statistics of the measurement in Table 1. In this case, there is no resemblance at all neither in the histograms nor in the statistics. However, chemical and artistic analysis along with historical data indicate that the two paintings may be strongly connected. Actually, if we deal with very deteriorate paintings, this standard DFT-based method may fail even in its basic thread counting task. As an example, let us consider an artwork by Goya, labeled as S0A001. Its X-ray is quite difficult to analyze because the prime coat makes several threads look like only one, as seen in Fig. 3(a). Most of the painting is similar to that. The mode of the histogram, shown in Fig. 4, yields 5.15 and 6.81 for vertical and horizontal threads, respectively. On the contrary, Fig. 3(b) shows a very clear area we found within the X-ray, where we can manually check that there are approximately 10 vertical threads and 7 horizontal ones. Henceforth, the thread counting fails.  Therefore, our objective will be to find another characterization that is able to count threads and discover similarities between canvases even when the previous methods do not work. To do so, we will search for a fingerprint that portray the whole roll and even the production process.

Lattices in vector form
Throughout our analysis of the Fourier description of a canvas, we will find out the usefulness of a lattice, i.e., a grid of points that follow a regular pattern. Lattices are customary in fields like crystallography [22] or Fourier optics [23]. Let us first consider a squared lattice 0 Λ , i.e., a set of evenly spaced integer points, as represented in Fig. 5(a).
Although a lattice can be described in terms of one-dimensional functions, it is much more suitable to use a vector Nevertheless, we will have to handle quadrangular lattices with non-squared spaced points and even oblique arrangements, as shown in Fig. 5(b). Let us denote such a lattice by Λ . For this more general case, take any basis of the grid in Λ and consider all the vectors that are integer linear combinations of the basis, , and rewrite the grid in lattice Λ from the points in 0 Λ , Besides, the basis (a, b) or, in other words, the transformation matrix Q, defines a fundamental parallelogram in Λ whose area is det( ) Q . The basis for Λ is not unique but the area remains always the same.

Reciprocal Lattice
Given a lattice Λ with points p, the reciprocal lattice Λ consists of all points q such that p·q is an integer. The linear transformation associated with Λ is given by T Q  and one basis for Λ is  (3) and (1) which is an integer. We can follow the same reasoning to proof that This means that the bases of Λ and Λ constitute two pairs of perpendicular vectors, as shown in Fig. 6(a).
Moreover, the area of the fundamental parallelogram of Λ given by (a, b) will be i.e., the inverse of the area of the parallelogram for the lattice Λ . In addition, Besides, from Fig. 6(a) we have cos sin( ) 2 a a a a a a and 1 sin( ) In other words, the length of a is the inverse of the distance between b and its parallel side in the fundamental parallelogram in Λ , as represented in Fig. 6(b). Analogously, the length of b will be the inverse of the distance between a and its parallel side.

Application to the Fourier transform
Bearing in mind the results above, we can face the Fourier transform (FT) of delta functions. Let us define where the variable x stands for any pair of coordinates in R 2 . Then, ( ) h x represents a set of impulses situated on the points of a lattice Λ . The reciprocal set of impulses corresponding to the reciprocal lattice Λ is We bring here a result from [24], which shows that the FT of h(x) in (11) is where 1 2 ( , ) f f  f is a two-dimensional frequency variable. Put in other words, the FT of a set of impulses corresponding to the lattice Λ is another set of impulses located at the points of the reciprocal lattice Λ.

Relation between lattices
From the previous subsections, we know the relation between the vector basis of a lattice and its reciprocal one.
However, we need a more general result to analyze more complex patterns, like the ones we find in fabrics. Let us derive this novel result.
If we express Q in terms of its coefficients, T Q  yields In addition, , a a b  is obviously another valid basis for the lattice Λ . Let us denote and apply a matrix rotation R of 90 degrees to this new basis. Then, which, combined with (15), yields Otherwise stated, the reciprocal lattice is merely a rotation of 90 degrees of the original one. Moreover, since   the reciprocal lattice is scaled in a way that the area of its fundamental parallelogram is the inverse of the initial area. This means, among other things, that angles and proportions are the same in both the original and reciprocal lattices and therefore, by virtue of Section 3.3, they are the same in both space and frequency domains. This result, which imposes a tight geometrical relationship between both domains, will play a fundamental role in the subsequent discussion.

Model of the weave pattern
In this section we propose a unified signal processing model for the fabric, comparing both space and frequency domains. A similar model was outlined in [19], but no theoretical proof was provided. In [13], results for some types of cloth are derived by computing the FT for every scenario. Our analysis will be more general, easily allowing the derivation of every result in [13] from our single model.
In an ideal case, a woven fabric has a periodic structure produced by the interleaved pattern of horizontal and vertical threads. This can be described as a convolution of a basic thread shape, b(x), and a field of impulses h(x) that creates the repetition pattern, as shown in Fig. 7. Put in other words, where i(x) is the image intensity. The basic shape b(x) gives information about the threads characteristics and is the more elementary unit in the weave. This basic shape will be repeated at evenly spaced points by means of the convolution with h(x) [19].
Although we have different choices for b(x) and for the vector basis, for the forthcoming analysis becoming simpler we take b(x) as a horizontal rectangle and a as a horizontal vector, as in Fig. 7(b) and Fig. 7(c). This will be always possible due to the vertical and horizontal arrangement of the fibers. In addition, the two vectors a and b will be assumed to span an angle less or equal than 90 degrees. Moreover, if we take dv as the distance between two consecutive vertical threads and dh as the distance between two consecutive horizontal threads, a and b will be of the form Provided this condition, we can build right triangles like those in Fig. 9 (a) and Fig. 9 (b). In particular, the number of segments of length |b| in the hypotenuse is m whereas the number of segments of length |a| in the horizontal leg is n. Besides, the number of segments in the opposite leg will be always one. Fig. 9(c) and Fig. 9(d) shows the most important characteristics of these triangles.

Spectral analysis of the weave
Now, we recall the convolution theorem and from (19) we calculate the NDFT-point Fourier transform of the image intensity as where ( ) B f is the FT of the basic shape. Using (13), ( ) I f can be expressed as This means that the spectrum of the image intensity has components only in the frequencies determined by the grid of the reciprocal lattice. In addition, by virtue of (23), each point in the frequency-domain grid is scaled by the value of the spectrum of the basic shape at this particular frequency, as shown in Fig. 10. For its part, from our analysis in Section 3.4 we know that angles and proportions are the same in both space and frequency domains. This implies that, in the frequency domain, there must be a right triangle similar to the one already defined in the space-domain. As a matter of fact, we can observe that the triangle in Fig. 10(e) is a scaled 90º-degree rotation of the one in Fig. 9 (a), i.e., the triangles of both the weave and its Fourier transform are mathematically similar. We can use this result to infer the main characteristics of the weave pattern. First, we look for a right triangle in the grid formed by the spectral peaks. Therefore, from the previous discussion, we find the values of m and n by counting the number of segments in the hypotenuse and the vertical leg of this frequency-domain triangle, respectively.
Second, we can easily measure the sides lengths 1 L and 2 L (see Fig. 10) and derive the values for the thread frequencies, f h and f v , as follows. From (9), (20) and the triangles in Fig. 9(c) and Fig. 10(e), we could write Hence, we can calculate the vertical thread frequency as 1 1 On the other hand, from (10), (21) and the triangles in Fig. 9(c) and Fig. 10(e), Therefore, the horizontal thread frequency will be We need the value of p to estimate fh. However, we are aware that for most usual fabrics (e.g., plain-weaves and simple twills) and therefore fh would be uniquely determined.

Power spectral density: the averaged periodogram.
The previous results provide the theory that predicts how the FT of the fabric would be. However, in practice it is usually far from the theoretical result developed above. We estimate it from the X-ray images of the canvases but they do not present a uniform pattern along the warp and weft, i.e., parameters defining the weave vary, especially for old fabrics. In addition, part of the painting is superimposed and there are artifacts such as nails, patches or missing parts.
Finally, the theoretical studies assume infinite length sources, which obviously is not true. Therefore, the estimation of the spectral analysis of the weave is not straightforward. Fig. 11 shows an example where we cannot clearly observe the theoretical pattern in the DFT of a window, including maxima located in a grid, i.e., the weave pattern. Therefore, the variability of the handcrafted weave process, the placing of the canvas on the stretcher or even the painting itself may alter substantially the thread counting comparison between two fabrics even if they actually came from the same roll. In addition, if the sizes of two canvases are not big enough to facilitate that they come from the same part of the warp, the matching is not possible by spatial correlation of the countings. For all the above reasons, the standard DFT-based methods of previous papers may fail, as discussed in Section 2, because they amount to focusing only on the two main maxima of the DFT to perform the counting.
In this paper, we propose a novel approach in which, rather than finding the maxima of the DFT of a window, we estimate the whole power spectral density (PSD) of the fabric. Actually, we consider the canvas as a statistically nonstationary signal, since its properties vary with the actual swatch. Consequently, we compute the power spectral density of the image rather than the magnitude of the DFT. It is well known that this is the correct approach when nonstationary signals are involved [20]. More precisely, we resort to the averaged periodogram, i.e., we average the squared module of the DFT for several swatches through the X-ray of the canvas. The PSD provides a fingerprint of the canvas as a whole, i.e., it is an additional approach where we focus on a general description of the painting. In this way, we will be able to extract some important features, which will help us to compare canvases where the thread count offers inconclusive results. In particular, we will be able to infer the weave pattern (as explained in Section 4.1) from this averaged spectrum. This is a characteristic that cannot be deduced from previous techniques.

pixels
Taking for now the periodogram ( ) S f as a first PSD estimate, we have that (23) turns into Therefore, the theoretical PSD of the image intensity has its components only in the frequencies corresponding to the grid of the reciprocal lattice, as the magnitude of the DFT had. For this reason, the analysis of Section 4.2 is completely valid now, too. However, the periodogram is not a consistent estimate, i.e., its variance does not asymptotically approach zero with increasing signal length. Hence, we would rather use periodogram averaging. The averaging is used to decrease the variance of the spectral estimation [20].
More precisely, the image is divided into segments of N N  samples, with a window 1 2 ( , ) w n n applied to each.
The displacement between two consecutive segments is D, i.e., we form the r−th segment If D  N the segments overlap whereas they are contiguous if D  N. Hence, the overlapping ratio s will be The total number of segments K depends on the relationship among D, N and the size of the image.
Then, the discrete periodogram of the r−th segment is The main advantage of this averaging is that the variance of this PSD estimator is inversely proportional to the number of segments. Thus, the variance tends to zero when K increases. In practice, averaging helps to reduce the contribution of deteriorate parts in the canvas, deformed areas or the painting itself. This yields a quite robust estimator.
In addition, this method can be readily computed in parallel with the regular thread counting at virtually no additional cost, because both of them share the main core computation, i.e., the DFT of the windowed segments.

Extraction of features
Once we have performed the spectrum analysis of the weave through the PSD, we focus on its characterization, which is not straightforward. Theoretically, the PSD should be a weave pattern with just some non-null points. In practice, we have a piece of fabric of finite length. The windowing used in the PSD computation is introduced to deal with this problem. As a result, the PSD is no more a set of non-null points but a full surface with maxima in the weave pattern. Besides, the averaging reduces the variance of the estimation but systematic imperfections, possibly caused by the loom design or the quality of the used threads, will be still present in the PSD.
Through experimentation, we found that the following four PSD features help to characterize the type of fabric: 1. First, we propose to observe the shape of the PSD at distant points of the center, whether it is diamond or crosslike. In Fig. 12, we include two examples of PSD computed with a 2048-point DFT of N = 400 pixels patches shifted D = 100 points with a Blackman-Harris window. In Fig. 12(a) we have a diamond shape, while in Fig. 12(b) a cross one. The shapes have been highlighted in thick dashed lines. The first one fits better with the theoretical result, as we have points and concentric contour lines around them where maxima points are predicted to be. On the contrary, the contour lines are elongated in Fig. 12(b). We conjecture that this elongation is due to imperfections of the cloth.
2. Then, as a second feature, we pay attention to the horizontal and vertical contour curves connecting the maximum points (marked with dots) in the diagonal to the vertical and horizontal axes. In Fig. 12(a) we include a triple-cross shape, in thin dashed line along the axes plus two horizontal lines. In Fig. 12(b) we have a simple cross, in thin dashed line along the axes.
3. A third characteristic to evaluate for is the shape of the contour curves of the PSD near the center. In Fig. 13(a) we find a C shape, while In Fig. 13(b) there is an O shape, meaning that a minimum is located between the center and the first maximum in the diagonal. For its part, in Fig. 13(c) we have a plain or \ type shape, where the PSD is equally decreasing from the center in any direction.
4. Finally, we propose to use the values along the axes. More precisely, we may find large values along the whole vertical or horizontal axes or just at some points of them. For instance, in Fig. 12(b) the PSD has a strong value along the vertical axis.

Examples of PSD and variance reduction
We first propose to illustrate the technical description of the theoretical Fourier transform of fabrics in Section 4.2 by using the PSD. We include here two examples. First one is a plain-weave by Rivera. A detail of its X-ray is included in Fig. 14(a), where 200 pixels correspond to one cm. Its PSD estimation is shown in Fig. 14(b). Second one is a simple twill by Claudio de Lorena. Its spectral analysis is represented in Fig. 14(d), with the X-ray detail to the left. We mark with dots the local maxima found where the theoretical results predict them to be and plot the theoretical triangles describing the fabric. It is interesting to remark the clean and neat results of the PSD despite distortions and the painting itself. At this point, it is helpful to compare the result of the PSD to the DFT for a window. In Fig. 11(a) we included the same patch as that in Fig. 14(a) and the DFT of a 400´400 pixels window was shown in Fig. 11(b). Compared to

Thread Counting with PSD
The PSD can be used for thread counting by simply measuring the dimensions of the spectral triangle described in the theoretical results of our study in Section 4.2. For instance, the triangle for a plain-weave has its legs parallel to the axes, with a vertex in the origin and two segments in the hypotenuse. Then, the distance to the horizontal and vertical two other vertices provide the thread counting for the vertical and horizontal directions, respectively. For a plain-weave pixels pixels it amounts, most of the times, to find the maxima in the vertical and horizontal axes. In Table 2, we include the results of the thread counting by using histograms of a standard DFT analysis for several paintings. The first six ones are from the 17th century and of plain-weave cloth type. We include a pair of canvases, P07905 and P07906, that were recently studied at the Museo Nacional del Prado to establish their authorship; then, one by Rubens, P01627; one by Teniers, P01819; and two by Velázquez, P01182 and P03253. The last painting in Table 2 is S0A001, by Goya.
In   We now focus on painting S0A001, which presents by far the largest deviation. This is a quite difficult radiography to analyze because the prime coat makes several threads look like just one, as seen in Fig. 3. Actually, most of the N N  swatches are similar to the one in Fig. 3(a). We also recall that for Fig. 3(b) the thread counting is approximately 10 for vertical threads and 7 for the horizontal ones, whereas from the histogram in Fig. 4 the mode is 5.15 and 6.81, respectively. As a matter of fact, the histogram of the vertical counting is quite confusing.
In Fig. 15 we include the PSD computed with a 2048-point DFT and an N = 400 pixels Blackman-Harris window.
We depict as dots all the local maxima found. Since it is a plain-weave type, we look for the triangle predicted by the theoretical results. Their vertices provide the thread counting as the distance of them to the origin. The triangle has been highlighted in Fig. 15, giving a thread counting of 9.96 and 6.95 for vertical and horizontal threads, respectively.
With this triangle, where the maximum in the hypotenuse is taken into account, we discard local maxima in the PSD to provide a correct thread counting.

Features in PSD
Finally, we propose to use the features in Section 4.4 to classify the fabrics of the first six paintings in Table 2.
From it, we can conclude that all countings are in the range 10.61-13.43 threads/cm. First, if we focus on the vertical or horizontal mode value with minimum StD for each painting, and we assume a difference of one thread per cm as a rule to decide for similarity, we found that we can gather P07906, P01819, P01182 and P03253 in one group for their quite close threads counting, (and P07905, P01627 in another). Similarly, studying the counting with larger StD, paintings P07905, P7906, P01627 and P01819 could be related. Therefore, we could conclude that all belong to the same fabric, which does not make sense since some of them were painted by different authors.
We have included the PSD for these paintings in Fig. 16. First, we check the shape of the PSD at distant points of the center. We find that it is diamond shaped in Fig. 16(a), Fig. 16(b), Fig. 16(e) and Fig. 16(f) for P07905, P07906, P01182 and P03253, respectively. On the contrary, it is cross-like in Fig. 16(c) and Fig. 16(d), for P01627 and P01819, correspondingly.
Then, we pay attention to the second feature, the horizontal and vertical contour curves connecting the maximum points (marked with dots) in the diagonal to the vertical and horizontal axes. It can be observed that Fig. 16(a) and Fig.   16(b) have a large number of them in the horizontal, generating a particular double-cross shape. A third characteristic to evaluate for is the shape of the contour curves of the PSD near the center. While in Fig. 16(a), Fig. 16(b) and Fig.   16(c) we find a C shape, in Fig. 16(d) we have O shape, and in Fig. 16(e) and Fig. 16(f) we have a plain or \ type shape. Finally, we check for the values along the vertical and horizontal axes, where we find that in Fig. 16(c) and The result of the analysis of these features for the paintings in Fig. 16 is summarized in Table 4. From this table we conclude that P07905 and P07906 share the same diamond shape in the edges as P01182 and P03253, but exhibit a strong horizontal connection of the diagonal maxima to the vertical axis, with C shape around the center. Therefore, the pair P07905-P07906 does not share features with the other paintings and are likely to have a fabric from the same origin, even if they have more than one thread of difference in the horizontal threads counting, where the standard deviation is much lower. Similar conclusions can be drawn for the pair P01182-P03253. The fabrics of paintings P01627 and P01819 exhibit a cross shape and even a high value along an axis, but different behavior around the center.
Besides, recall that they have large differences in the thread counting. Therefore, they cannot be matched between them, nor to any other painting in Fig. 16.

Conclusions
In this paper, we have proposed a new method to analyze and characterize the fabric of canvases. This technique is based on two different and complementary viewpoints. First, a theoretical analysis of the weave in the frequency domain and the use of triangles in it to find the main characteristics of the threads. Second, the use of the PSD rather than the DFT and the search of distinctive features in it. The result is a fingerprint that portray the whole canvas. We have shown that this approach is of great utility for both thread counting and paintings pairing, even in situations where previous methods fail, like very old and deteriorated artworks or simply canvases of small size. This information, combined with the study of historical sources or artistic and chemical analyses, help the museums in their research, such as dating or attribution of the paintings.