• 沒有找到結果。

Washing Model

CHAPTER 5 WASHING

5.2 Washing Model

This section introduces how we simulate the traditional dyeing technique

“washing” (渲染)of Chinese Fine-Brushwork Painting. Our model is based on the actual painting procedure and observations. We imitate the procedures of painting and apply several methods in image processing to synthesize the result of washing. First, washing paths are constructed as discuss in section 5.1. Then, when the brush sweeps along the washing paths, we may apply an exponential function to simulate color diffusion. Finally, we mix the color pigments with background color to produce the result.

5.2.1 Washing by Water Pen

There are pigments in colored pen when washing. Watered pen just delivers water for pigments diffusion. In our proposed model, we combine the colored and watered pens and apply pigments on the watered pen directly.

It is different from sketching the contour. Since the brush for washing is softer than Hong-do pen, we use an ellipse to model the contact region of watered pen on alum-Hsuan paper. For easy of implementation, the size of ellipse is fixed. Figure 5.4(a) shows the contact region C. Variables a and b are the major axis and minor axis respectively.

Ellipse C will move along the washing paths and sweep the footprints as the color calligraphy on the canvas. It is similar to the brush model described in Chapter 4.

But, it is a little difference. Ellipse C will rotate when moving along the path.

forward along Qi, it will aim its y-axis at the direction of point Pk’s tangent on the curve.

Figure 5.4 Washing model

When C moves along with Qi, C will leave pigments on the canvas. We hypothesize that every point has its capacity. We set pigment 100 is full, 0 is empty.

When C passes though Pk, we will decide how much percentage of pigments to leave by C according to an exponential function. That is a method which we figure it out by observing artists’ washing.

To implement this method, we set two thresholds tLow and tHigh. They will influence dyeing color’s variation. Then, we pick a random number r between these two thresholds. Variable r is the power of the exponential function as shown in Eq 5.1.

We pick 100 points P on curve Qi. It means ellipse C will cover Qi one hundred times.

Nall is the total pigment number on the brush. The pigment number NPk that C left on Pk is:

(b) A path for washing (a) Contact surface

99 ,

In Eq5.1, when setting a larger r, the exponential function will vary sharply. Then, we may get intensely variation of color. In other way, if we have a smaller number of r, we generate color variation smoothly. The number of r is controlled by thresholds tLow and tHigh. We can adjust them automatically according to the input image. The

detail procedure of their determination will be depicted in next section.

When C leaves a footprint on Qi, we divide NPk equally by the amount of pixels in C and set it to the quantity of these pixels’ pigment. If it exceeds the capacity of pixel, we set it the maximum of capacity. After C passes by one Qi, system will compare the pigment distributed on Qi with the pigment on Qi-1. If the pixel on the same position already has some pigments in previous step, the more will be selected and will remain instead of adding them together. We suppose that watered pen will take some pigments away when pigment’s quantity of a pixel is too high. It avoids the situation that pixels are always at the state of saturation. In addition, to avoid that every curve Qi uses the same exponential function, this situation will lead to the result of being too smooth. So, we choose random number on every Qi again to decide variable r, the power of every exponential function. Figure 5.5 shows examples of washing.

Figure 5.5 Examples of washing with random randnum by tHigh=8, tLow=3

5.2.2 Parameters Determination

When applying washing, we need to determinate three parameters, tHigh, tLow, Nall. The last one is specified by users because it depends on the consistency of color pigment they want to dye. But parameters tHigh and tLow, can be decided by color variation of the input image.

Figure 5.6 Parameters determination

As shown in Figure 5.6, the blue one is the area we want to dye. The points Ustart and Uend are the starting and the ending point. We divide line UstartUend into four parts equally by points U1, U2 and U3. Then, we separate them into two groups, colorstart and colorend, by comparing their color in input image. We calculate the color disparities separately between Ui and Ustart, Ui and Uend. If Ui’ color is close to Ustart’s, set Ui in the group of colorstart, and vice versa. After all points are assigned, we can find the boundary of two groups, such as the line L in Figure 5.6.

Since L corresponds to the color changed sharply in input image, we determine thresholds tHigh and tLow according to L’s position. If L is close to point Ustart , we set a large thresholds to obtain dyeing color vary sharply near Ustart and vice versa.

The following List 5.1 shows the values of tHigh and tLow and Figure 5.7 shows their influence.

Table 5.1 The values of thresholds in washing L position value of tHigh value of tLow

between Ustart and U1 13 10

between U1 and U2 8 3

between U2 and U3 3 1

between U3 and Uend 1.5 1

Figure 5.7 Examples of washing by (a) tHigh=13, tLow=10 (b) tHigh=8, tLow=3 (c) tHigh=3, tLow=1 (d) tHigh=1.5, tLow=1

5.2.3 Color Mixture

Every time after simulating the effect of washing, we will start to do the color mixture. In our system we take Subtractive Color Mixture to model the overlapping of color. In section 5.2.1 we got an image with the distribution of color pigments. We still map the pigments’ quantity to color. We set the color of canvas as the background color such as yellowish brown. Because the capacity of pigment is 100, the full pigment (100) will totally cover the background. It will show the color which we want to dye. If the pigment is less than the full capacity, the percentage of pigment will determine the degree of color mixture. As Eq 5.2 shown below, Nx,y is the pixel’s quantity of pigment, colord is the color which we want to dye, and colorb is the background color. The pixel’s color colorx,y will be:

colorb

Since the process washing will be performed several times, we let the current pixel’s color be the background for the next washing process. Therefore, we can achieve the goal of multilayer color mixture. List 5.2 shows the algorithm of washing.

Table 5.2 The washing algorithm Washing Algorithm

Input: --- CloseSetClas area /* painting area and washing paths */

ImageClass inputImg /* background image */

Color col /* dyeing color */

Int Nall /* quantity of pigment in watered pen */

Double tHigh, tLow /* thresholds of exponential function */

Output: --- ImageClass outputImg /* washing image */

---

for(every points x in watered pen )

rotate the mask of watered pen, aim its y-axis atP ’s tangent; k Nx = ( NPk / watered pen.size)+ Nx ;

相關文件