5.4 The countingVermeer software
5.4.1 Introduction
The countingVermeer software was used to generate all the weave and angle maps of this chapter and chapter 6, and it can be used in several ways to examine X-rays of Vermeer’s canvases (or that of any other artist), in order to generate weave and angle maps. There are three basic functions, which are all available from the interface shown in figure 1, § 4.2. The threadCount function is used to calculate the weave and angle maps; this results in a weave map file containing the estimated thread densities and angles for both the vertical and horizontal directions for each region throughout the X-ray of the canvas. The function displayWeaveMaps exhibits the estimated densities and angles as colored images, and can also provide summary information such as averages, standard deviations, and histograms. The third function, align, displays weave maps from two different paintings, both at the same resolution, and allows for moving, rotating, and flipping the images in order to help locate plausible thread count matches.
5.4.2 Display weave maps
The interface for displayWeaveMaps is shown in chapter 5, figure 1, which opens on the summary page displaying four images: the vertical and horizontal thread densities and the vertical and horizontal angles. The numerical values (for instance, 14.39 +/-1.29 threads/cm) show the average and the standard deviation about that average for the horizontal thread density. The interface of displayWeaveMaps contains many options for choosing and viewing weave maps and angle maps. Enlarged images and more information can be obtained by choosing the checkboxes Hthread, Vthread, Hangle or Vangle (see the interface options in figure [1]). In this view, a colorbar displays the precise values represented by the various colors. The two sliders labeled color low and color high change the displayed colors to focus the image on various ranges of values. For the specific weave map shown in figure 1, the two sliders have been adjusted so that the darkest colors represent thread densities of a little less than 12 threads/cm, while the lightest colors represent thread densities just slightly greater than 18 threads/cm.
Choosing the display option histo presents histograms corresponding to the four images of the summary page [2]. These show the distribution of values in each of the four maps and typically show a middle peak value and a bell curve-like variation about that center value.
Three other controls are the change directory button (to allow selection of different weave maps calculated using threadCount), snapshot, which saves the currently displayed page to a file, and the color map menu bar, which allows selection of a wide variety of color maps for the displayed images.

1
The Hthread, Vthread, Hangle, and Vangle display options present a more detailed version of the selected map.

2
Selecting the histo checkbox presents histograms of values corresponding to the four maps. These represent the range and variety of values that occur in the estimation procedure. Data shown is for Woman Writing a Letter, with Her Maid. Typically, the histograms display a roughly bell-like shape.
5.4.3 Align
The align function reads weave maps from two different paintings, both at the same resolution and using the same color scheme, and allows moving the images around in order to look for good thread count matches. For example, suppose that the agreement between the thread counts of Woman Writing a Letter, with her Maid (L31) and Woman with a Lute (L14) suggest the possibility of a weave match. Figure [3] shows the align program immediately after choosing these two files. As it reads a pair of images, align calculates and displays a common set of colors. Looking at the color bar in figure 3, the blue tinge of the horizontal thread map of A Lady Writing a Letter with her Maid (L31) is centered somewhere near 11 threads/cm, while red coloring of the horizontal thread map of Woman with a Lute (L14) shows it is nearer 20 threads/cm. No match is possible!
However, selecting the vertical weave map of A Lady Writing a Letter with her Maid (L31), by changing the selector from H to V, presents the more promising situation shown in Figure [4]. Clearly, the two images have features of the same general magnitude. After rotating Woman with a Lute (L14) by 270 degrees, it is possible to slide the images around (using the mouse) to achieve a convincing match, as shown in Figure [5].

3
Opening the align function and selecting Woman Writing a Letter, with her Maid and Woman with a Lute does not appear promising at first.

4
Choosing to display the vertical weave map of Woman Writing a Letter, with her Maid simultaneously with the horizontal map of Woman with a Lute realigns the display, and features in the two images become comparable.

5
After suitable choices are made (in this case, rotating the Woman with a Lute canvas by 270 degrees), the two weave maps can be repositioned using the mouse to provide a more convincing match.
5.4.4 Calculate weave maps
The most complex function in the software, threadCount, allows direct calculation of weave and angle maps of your own canvas X-rays. The input to the threadCount function is an X-ray of a canvas in tif format; the output is a file containing data that represents the vertical and horizontal thread density estimates and the vertical and horizontal angle estimates. These data files have been precomputed for the full set of Vermeer’s canvases, and so there is no need to use threadCount when studying the work of Vermeer.
On the other hand, it is possible to use the functions displayWeaveMaps and align with any canvas, by first calculating the thread data. There are several choices to be made, which correspond to various properties of the Fourier Transform. Since the software is slow (there are a lot of calculations), it is helpful to choose the parameters wisely. The interface for threadCount is shown in figure [6]. At startup, there is no image loaded and it is necessary to select a *.tif canvas image file using the load X-ray file button. The two input boxes labeled horizontal mean and vertical mean must be filled with estimates of the thread counts (in threads/cm) as derived from manual thread counts. The block size specifies the size of the regions used in the Fourier calculations, for example, 0.5 means that the regions are 0.5 x 0.5 cm squares. The overlap specifies how many regions touch each pixel: an overlap of 2 with a 0.5 cm block size means that successive regions are offset by 0.25 cm. The main effect of the block size (called FFT size in the interface) is to give a smoother picture for 1024 while giving a quicker calculation for 512. The resolution, in dots per inch (DPI), must also be specified in order for the function to be able to translate pixels into physical units.
Once the options are selected, press Calculate, and prepare to wait; the progress bar (shown empty on the right hand side of figure 6) will move slowly. When finished, a data file is written (to the same directory as threadCount) with a name such as threadcountL07(0.5-2).m. This indicates that it is a thread count file of canvas The Milkmaid (L07) with parameters block size ½ and overlap 2. It is a text file containing four matrices; each matrix is an arrays of numbers, one for each region, containing the values of the Horizontal and Vertical counts and angles.
Chapter 6 shows how the weave and angle maps can be applied to study the canvases of Vermeer.

6
The interface for the threadCount function, which calculates the weave and angle maps, and writes the results to a file for later display with displayWeaveMaps and align.