Abstract
For purpose of reconstruction and innovation of indigo patterns, this study explores modeling, reconstruction, and assembling of the pattern elements by means of mathematics. A model for indigo pattern elements is proposed based on cardinal splines, in which the rigidity of shape is conveyed by the tension coefficient, and the concavity and variety by configuration of the knots. The generalized version of this model is capable of covering any complex element. The contour tracing technique is employed to extract pattern elements from the image, and the closest model instance is selected in virtue of invariance of the improved Hu moments. The selected instances are transformed with respect to the geometric center, the coverage, and the coincidence to match the pattern elements in the image so as to reconstruct the whole pattern. The element filters are conducted on the reconstructed patterns to modify the elements and produce new innovative patterns of constant skeleton. The model is borrowed serving as a skeleton in element assembling. The skeleton properties are investigated to provide basis for skeleton embodiment in which these properties are involved into establishing the placement determiner and element determiner so as to carry out the assembling of elements. Also discussed is the extended skeleton which goes beyond the model and brings about variety and flexibility to element assembling. It is turned out that reconstruction with the model well implements a mathematical copy of the pattern, and the assembling of elements by skeletons provides rich possibilities to innovation of indigo patterns.
Introduction
The indigo patterns, which carry special cultural meanings in China, Japan, and other East Asian countries, are a unique type of patterns composed of various kinds of dots. 1 Through the varied size, shape, and spacing of dots, the ethnic aesthetics are spread. 2 Used to be prosperous, today these patterns have declined and retreated into museum as an intangible heritage owing to the vacancy of innovation. Now it has been urgent demand to rescue and recover the indigo pattern so as to help the traditional culture protection. There are plenty of studies focusing on cultural and artistic meaning of traditional indigo patterns. However, for innovation of these patterns, there exists few, if any, documented explorations. Although the pattern elements can be fetched and reconfigured manually with some graphic design software, 3 there is little idea in terms of automation presented by this kind of method. Some study has suggested to recognize and reconstruct weave patterns with computer-aided image analysis techniques, 4 but not purposed to invent new ones. Researchers have reported textile pattern generation by visualizing the famous fractal models, including iterated function systems,5,6 the Julia set,7,8 and the L systems.9,10 Another important model for visualization is the weak chaos system 11 upon which there are the derived mechanisms like Quasi-regular system, 12 uniform stochastic web, 13 and Hamiltonian function. 14 These models and algorithms, though being able to create patterns from scratch, fall short of effective solutions for bringing innovation to existing patterns. As a matter of fact, pattern innovation is equally important as pattern creation, for the former can help remold and promote the traditional designs. Our endeavor sets forth a mathematic model for indigo patterns, with which the patterns can be matched and reconstructed so as to achieve parameterization. The parameterized elements are then modified by the filters or assembled with skeletons to produce innovative designs. Modeling, reconstruction, and assembling of pattern elements presented in this study can play an important role in redemption and promotion of indigo patterns.
Research methods
Materials involved in this study come from an authority collection of indigo patterns 15 which includes many classic and representative designs as illustrated in Figure 1.

Indigo patterns and their features.
As demonstrated, these patterns are composed of different kinds of dots. These dots, varying in size, shape and spacing, are the so-called pattern elements.
Modeling
There are various shapes of pattern elements. Influenced by traditional oriental philosophies, indigo patterns in terms of formation are stressed with “embracing rigid and soft, concave and convex, spare and dense” to reach a unity of opposites, as indicated in Figure 1.
The goal of element modeling is therefore to cover as many shapes as possible, especially those of softness or rigidity, concave or convex. The cardinal spline is employed in this study to meet this goal, as explained below.
Tension coefficient
Given four control points
Hereinto, a is the interpolation parameter, and h1, h2, h3, and h4 are the classic cubic Hermite polynomials
The spline takes
Hereinto,

Splines of different tension coefficients: (a) t = 1, (b) t = 0.5, and (c) t = 0.
The smaller the t is, the harder the spline looks. In the case t = 0, the spline turns to straight line. In order to make a closed curve, several splines need to be joined head to tail under some rule. Given there are four knots

Closed curves composed of four cardinal splines—(a) t = 1, (b) t = 0.5, and (c) t = 0.
The four splines join head to tail to produce a closed curve which can be regarded as a prototype of the pattern elements. The rigidity of the elements is therefore controllable by the tension coefficient.
Knots configuration
Put the closed curve into the rectangular coordinates and further stipulate that

Element model.
There are five shape parameters in the model including
The range of active radiuses are confined so as to avoid elongated shapes that are not recommended in indigo patterns. The regulation on deviation angles prevents the activity spaces of the two knots from overlapping. The range of tension coefficient is determined by the nature of cardinal splines.
Once the shape parameter values have been designated, the specific shape of the model, called model instance in this study, is determined. The model instances can be then put through affine transformation in the latter stage to match the elements in an indigo pattern. Some typical pattern elements in the form of model instances are presented in Table 1.
Pattern elements versus model instances.
As suggested, the model represents concavity in case that one of its active radiuses is negative. This model is able to cover various kinds of shapes, including those of rigidity/softness and concave/convex.
In practice, to satisfy the requirements of digitalization, the shape parameters will be restricted to discrete values so that a limited number of model instances can be acquired. Given that the parameters are uniformly sampled for
Hereinto,
Reconstruction
In pattern reconstruction, the most suitable model instance for each element is to be found and transformed to construct a parameterized pattern. First of all, the pattern elements need to be extracted from the image. Then, selected from the large collection of model instances, the most suitable one for an element is put through the affine transform to match the element and replace it. A parameterized pattern is achieved as all elements in the pattern are replaced with the transformed model instances.
Element extraction
This research takes advantage of the contour tracing techniques 17 to extract element profiles from binary images of indigo patterns. There are two kinds of pixels in a binary image, target pixels (indicated with white dots) and background pixels (indicated with black dots), as illustrated in Figure 5. Contour tracing for a target area can be conducted in the following steps:
Scan the pixels row by row until the first pixel of the target (denoted as “P”) is met.
Set the initial direction for searching at point P as bottom left, and the searching direction adds up 45° counterclockwise every time until the next target pixel (denoted as “Q”) is found.
Set the searching direction at point Q as the current direction plus 90° clockwise, and rotate by 45° counterclockwise each time so long as the next target pixel is met.
Repeat step 3 to find more target pixels in the boundary until the original point P is returned.

Schematic of contour tracing.
These steps can be interpreted by the schematic diagram in Figure 5, in which the solid arrow at each point indicates the initial searching direction.
Before contour tracing being carried out to extract the elements in the pattern, some necessary preprocessing have to be brought ahead on the pattern images, as demonstrated in Figure 6.

Procedures of element extraction: (a) original (grayed), (b) median filtering, (c) threshold segmentation, and (d) contour tracing.
At first, the original image is handled with the median filter 18 to remove noise, and then the Otsu’s algorithm 19 is employed to do image segmentation, separating the elements from background. Finally, contour tracing is followed to extract the contours of all elements in the pattern image, as indicated in Figure 6(d).
Instance selection
The Hu moments of an image correspond to a series of images among which any image can transform into other ones by translation, scaling, and rotation. In other words, the Hu moments are invariant to affine transforms.
20
Upon the classic Hu invariants, an improved version has been introduced to remedy the dependence and incompleteness of the classic ones.
21
They are both conveyed in terms of the standard moments. For a two-dimensional signal, to be specific, a digital image, its p + q–order standard moment
Hereinto, N and M are height and width of the image respectively. The improved invariants are defined as follows
where
Moreover, the image’s centroid (geometric center) coordinates
The contours involved in this research, including those of elements extracted from the pattern and those of the model instances, are rasterized into images in order to take advantage of the improved invariants. When selecting the model instance for an extracted element, the improved moments of the element are calculated and compared with those of each model instance, and the closest model instance is found in line with the smallest Euclidean distance between their improved moments, as demonstrated in Figure 7.

Instance selection based on the Hu moments: (a) pattern element, (b) instance 1, (c) instance 2, and (d) instance 3.
As indicated in Figure 7, instance 3 with the smallest distance is selected for the pattern element as the closest model.
Instance transform
Next, the closest model instance must pass through affine transforms (including translation, scaling, and rotation) to match the element as much as possible. There are two necessary conditions for the model-to-element matching. One is the consistency of their geometric centers and another is the equality of area.
Provided the geometric center

Instance transform.
Then the coverage of the two shapes are calculated, and the model instance is scaled to the extent where the areas are equal. The scaling rate at this point is marked down as s. Then the model instance is rotated on its geometric center to reach the maximum overlap, and the rotation angle at this point is denoted as
The

Reconstructed patterns corresponding to the concerned areas indicated in Figure 1.
The reconstructed patterns seem acceptable but not so much perfect due to some inevitable errors. These errors might come from the handwork of drawing and printing under traditional crafts, or from the pattern imaging process including image acquisition and preprocessing, or from the stage of model instance matching.
Assembling
The model is so far directed at the pattern elements. But actually it can also serve as a frame or skeleton for element collections as the skeletons share some rule with the elements in terms of construction, which helps carry out the assembling of elements. Basically, there are two kinds of assembly represented in most indigo patterns: centered assembly and threaded assembly, as illustrated in Figure 10.

Two kinds of assembly: (a) centered and (b) threaded.
The skeletons are indicated with red in the figure. In the centered assembly, the elements are positioned on the skeleton with respect to a core point that is called “skeleton core.” While in threaded assembly, the elements on the skeleton are settled concerning the tangent direction at the point. Therefore, element assembling in a pattern can be investigated through the skeletons.
Skeleton properties
If the skeleton takes the shape of a modeled element, as illustrated in Figure 11, the points

Element “round” as a pattern skeleton.
The point
The total length of the skeleton (denoted as L) is
These three properties play a role in the next stage of skeleton embodiment, which refers to distributing elements along the skeleton.
Skeleton embodiment
The implementation of skeleton embodiment involves a seed element, a placement determiner
The placement determiner that distributes elements at the points where the path lengths meet the specific values can be expressed as follows
In regard to the element determiner, its primary role is to filter the element’s rotation angle
Examples of the skeleton embodiment are demonstrated in Figure 12.

Skeleton embodiment: (a)
The skeleton in Figure 12(a) takes the form of the modeled “square” and is embodied by the seed “columnar.” The placement determiner evenly places the seed at the interval
Patterns in Figure 12(c) and (d) both take the “shell” as their skeletons which are embodied by the “rice” elements. They are different in that the
Patterns in Figure 12(e) and (f) employ an element filter on model parameter s to bring about gradual increase in the scale. Besides, the latter introduces a nonlinear placement determiner to produce growing intervals for element placement.
The above examples show the embodiment of the two kinds of basic skeletons with the model, among which the element gradients in Figure 12(b) and the nonlinear element distribution in Figure 12(f) are innovative refactorings for the traditional indigo patterns.
Results and discussion
Model
The model proposed in this study involves four knots, based on which four cardinal splines connected head-to-tail are regulated to form a closed figure that is intended to serve as a template for pattern elements of indigo. The tension coefficient is borrowed to express the rigidity of the shape, and the concavity and variety are achieved by deploying the active knots. It is turned out that this model can represent most traditional pattern elements very well. However, there do exist some kinds of elements beyond its reach, especially those practically less adopted due to the limits of traditional crafts. 3
Limits
Owing to the restrictions on the range of active radiuses

Limit on aspect ratio.
A simple way to solve this problem can be extending the range for active radiuses, at the cost of lowered efficiency in the stage of reconstruction due to more instances involved.
Moreover, some elements of complicated shapes fall beyond the capacity of this model, examples being demonstrated in Figure 14.

Elements of complicated shapes: (a) scale, (b) treasure, and (c) starlight.
More knots are needed to enable the model representing an element in a more detailed way. This could be achieved by generalizing the four-knot model as discussed in the following section.
Generalization
Given

The generalized model: (a) number of knots and (b) range of activity.
Assume that each knot can deviate from its position to some extent, and their coordinates determined by active radius
In the generalized model, each knot corresponds to two parameters (active radius and deviation angle). With the addition of tension coefficient, there are

Complex elements expressed by generalized model: (a) 6-knot model, (b) 7-knot model, and (c) 8-knot model.
However, more knots in the model bring about increased number of parameters, which in turn leads to exponential growth in model instances and heavy computation in reconstruction. With the accuracy and efficiency of modeling and reconstruction foreseeable and deducible, the value of n should be therefore determined considering the complexity level of the pattern elements in practice.
Reconstruction
In this study, the contour tracing technique has been employed to extract the pattern elements in the image. The improved invariants are used to select the closest model instance for an element, followed by affine transforms on the selected instance to match the element in the pattern. Pattern reconstruction is achieved after all elements in the pattern being matched. Experimental results have showed that the pattern reconstruction mentioned above worked pretty well in element extraction, model instance selection, and transform.
This kind of reconstruction, though restores the pattern, may falls short of innovation. This can be remedied by element filtering on the reconstructed patterns.
Remolding with element filters
As mentioned earlier in the “Skeleton embodiment” section, element filters are employed to modulate the values of model parameters. The parameters involved in filtering can be both shape parameters and affinity parameters. Examples of element filtering conducted on the pattern in Figure 9(a) are illustrated in Figure 17.

Remolding with element filters: (a)
The filter in Figure 17(a) acts on the tension parameter t so as to alter that of all elements in the pattern, whereas the filter in Figure 17(b) discriminates the elements in the pattern by the scale parameter s and carries out different treatments on parameter r1. These filters on the reconstructed pattern can be expected to modify the pattern’s appearance while keep the overall frame or skeleton unchanged.
In practice, this kind of modification with filters should be elaborately carried out to retain the peculiar style of the original pattern as required. The user can trying with small steps to find the appropriate remolding.
Model instance database
Due to the huge number of model instances, the stage of instance selection for an element often turns out to be the performance bottleneck, especially when the generalized model is employed. To relieve the performance load in model instance selection, a model instance database can be established. In the database, the shape parameter values and the geometric features (including the Hu moments, the geometric center coordinates, and the coverage) of each instance are calculated and recorded.
For a model parameterized by the knot number n and the sampling count m, the related database is generated only once, as manifested in Figure 18.

Generation of the model instance database.
Thus, it can be evaded to build model instances and calculate the Hu moments every time selecting an instance, and the feature values recorded in the database can also be reused in transformation of the selected instance.
Assembling
To expand its use for delivering element assembling, the model has been further employed as a skeleton for the pattern. The skeleton properties including path length, core angle, and slope angle have been explored and participated in the embodiment so as to conduct the assembling of elements. Results reveal that the two primary kinds of assembly (the centered and the threaded) can be well manifested with the skeleton, and the three factors (the seed, the placement determiner, and the element determiner) together are capable of generating large number of novel patterns.
However, the skeleton can go beyond the model in some sense to become the so-called extended skeleton, since the modeled figure is not a necessity for skeleton properties and embodiment. As explained earlier, the core of a skeleton takes the model origin as its position to represent the inclination of the elements in the centered assembly. Actually, the core does not have to reside in the model origin, as illustrated in Figure 19(a).

Examples of extended skeleton: (a) centered assembly with the core not in model origin and (b) threaded assembly on plain spline with growing element scale.
To be more radical, the skeleton is not necessarily regulated by the model. It can take a form of any kind of curve, provided all points on the curve can be fetched and the three skeleton properties available. Figure 19(b) gives an example of threaded assembly on the plain spline. These extended skeletons can benefit the element assembling in variety and flexibility.
Conclusion
This effort models the indigo pattern element based on cardinal splines, taking advantage of the tension coefficient to convey the rigidity of shape, and achieving shape concavity and variety by introducing active knots. The generalized model is also proposed for those elements whose shapes fall beyond the capacity of the four-knot model. It is turned out that the four-knot model is able to represent most of the common elements, while the generalized model is capable of expressing complicated shapes with appropriate number of knots.
In regard to reconstruction, the contour tracing technique is employed to extract pattern elements from the image, and the closest model instance is found out taking advantage of the invariance of the improved moments, followed by affine transforms on the instance concerning the geometric center, the coverage, and the coincidence to match the element in the pattern. Experimental results have proved it an effective way to rebuild and parameterize the indigo patterns, while the element filtering provides an approach to generating new patterns from the existing. Moreover, the reusable model instance database is proposed to solve the efficiency problem in pattern reconstruction.
In respect to element assembling, the model is employed as a skeleton, and the skeleton properties including the path length, the core angle, and the slope angle are investigated in relation to the embodiment of the skeleton. The three factors including the seed element, the placement determiner, and the element determiner are put forward to implement the embodiment so that the assembling of elements can be achieved. It is turned out that the embodiment of skeleton can not only convey the two primary types of element assemblies including the centered and the threaded, but also produce a considerable wealth of new patterns. These patterns, though cultivated from conventional elements and delivering essential characteristics of indigo, have manifested remarkable novelty and diversity.
To sum up, the modeling and reconstruction of indigo patterns based on cardinal splines restores the patterns in a parameterized way, and the assembling of elements through skeletons produces innovative patterns that can be expected to bring new life to the heritage of indigo patterns. In addition, the ideas of modeling with knots, remolding by altering parameters, and assembling with skeletons proposed in this study would also apply to other kinds of patterns like the Plaid, the Paisley, and so on.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research is supported by the Soft Science Project of Zhejiang Province (2019C35G2180270), the Philosophy and Social Science Project of Zhejiang Province (19NDJC128YB), and the National Natural Science Foundation of China (51803185).
