**6. Analysis of the possibility of steganalysis by measuring the fractal dimension of the secret key before and after embedding**

The importance of steganographic watermark embedding is their steganographic attacks resistance. In this case, the problem arises of detecting the very fact of the introduction of the watermark into the cover image. For this purpose, the method of estimating the fractal dimension of the image before and after embedding the watermark can be used. Consider the problem of measuring the fractal dimension of color or black and white images after embedding the watermark into them [15].

As is known, a fractal is defined as a collection of objects for which the Hausdorff dimension is strictly greater than the topological dimension. The concept of self-similarity is used to estimate the fractal dimension.

A bounded fractal set in a Euclidean n-space will be self-similar if it is a union of different N (disjoint) reduced copies that can be scaled using a special scaling factor r. In accordance with the entered scaling factor, the fractal dimension D of set A can be obtained using Eq. (12).

$$D = \frac{\log \left( N \right)}{\log \left( 1/r \right)} \tag{12}$$

where N is the total number of boxes L needed to cover the fractal set; 1/r is the scaling factor of the box in relation to the image.

As a result, D is a dimension relative to the size of the box used to measure the fractal image. It can be said that the fractal dimension is a measure of how "complex" a self-similar figure is.

Let us consider the two most common methods for measuring dimension: differential box-counting and triangulation method.

The differential box-counting (DBC) method takes into account the difference between the maximum and minimum intensity values of the brightness of the image. Let an image be given with the size M � M, which is divided into "boxes" with the size L � L � L<sup>0</sup> (**Figure 7**). The height of the box L<sup>0</sup> divides the third coordinate of the image, which is the intensity value.

Space (x, y) of the image containing the values of the coordinates of the peakmudflows is divided into cells of size L � L, after which the maximum and minimum intensity values of (i, j) cell equal to l and k are found, respectively. The next step for each cell is the sum of the differences between the values found (Eq. (13)).

$$n\_{\tau(i,j)} = (l - k + 1) / L' \tag{13}$$

where r = L/M is the reduction factor.

After calculating the amount in all cells is the total amount of differences for the entire image (Eq. (14)).

$$N\_r = \sum\_{i,j} n\_r(i,j) \tag{14}$$

*w* ¼

*y* ¼

ð Þ *a* � *e*

ð Þ *c* � *e*

*o* ¼

*r* ¼

calculated (Eqs. (17) and (18)).

q

*A* ¼

q

*C* ¼

**Figure 9.**

**Figure 8.**

(Eq. (19)).

**95**

r

*The projected top surface of a triangular prism.*

*Using Algebraic Fractals in Steganography DOI: http://dx.doi.org/10.5772/intechopen.92018*

r

q

*Representation of a cell of the image in the form of a triangular prism.*

q

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

<sup>2</sup> <sup>þ</sup> ffiffi 2 <sup>p</sup> *<sup>=</sup>*2*<sup>s</sup>* � �<sup>2</sup>

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi *sa sa* ð Þ � *w* ð Þ *sa* � *p* ð Þ *sa* � *o*

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi *sc sc* ð Þ � *y* ð Þ *sc* � *q* ð Þ *sc* � *r*

> *sa* <sup>¼</sup> <sup>1</sup> 2

> > *sc* <sup>¼</sup> <sup>1</sup> 2

<sup>2</sup> <sup>þ</sup> ffiffi 2 <sup>p</sup> *<sup>=</sup>*2*<sup>s</sup>* � �<sup>2</sup>

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð Þ *b* � *a*

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð Þ *d* � *c*

<sup>2</sup> <sup>þ</sup> *<sup>s</sup>*<sup>2</sup>

<sup>2</sup> <sup>þ</sup> *<sup>s</sup>*<sup>2</sup>

; *x* ¼

; *z* ¼

; *p* ¼

; *q* ¼

Then, using the Heron formula, the semi-perimeters and areas of all triangles are

; *B* ¼

ð Þ *<sup>w</sup>* <sup>þ</sup> *<sup>p</sup>* <sup>þ</sup> *<sup>o</sup>* ; *sb* <sup>¼</sup> <sup>1</sup>

ð Þ *<sup>y</sup>* <sup>þ</sup> *<sup>q</sup>* <sup>þ</sup> *<sup>r</sup>* ; *sd* <sup>¼</sup> <sup>1</sup>

The total surface area is equal to the sum of the areas of individual triangles

q

q

r

r

q

2

2

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð Þ *<sup>c</sup>* � *<sup>b</sup>* <sup>2</sup> <sup>þ</sup> *<sup>s</sup>*<sup>2</sup>

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð Þ *<sup>a</sup>* � *<sup>d</sup>* <sup>2</sup> <sup>þ</sup> *<sup>s</sup>*<sup>2</sup>

ð Þ *b* � *e*

ð Þ *d* � *e*

; *<sup>D</sup>* <sup>¼</sup> ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

ð Þ *x* þ *p* þ *o* ;

;

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

<sup>2</sup> <sup>þ</sup> ffiffi 2 <sup>p</sup> *<sup>=</sup>*2*<sup>s</sup>* � �<sup>2</sup>

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

<sup>2</sup> <sup>þ</sup> ffiffi 2 <sup>p</sup> *<sup>=</sup>*2*<sup>s</sup>* � �<sup>2</sup>

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi *sb sb* ð Þ � *x* ð Þ *sb* � *p* ð Þ *sb* � *q*

*sd sd* ð Þ � *<sup>z</sup>* ð Þ *sd* � *<sup>o</sup>* ð Þ *sd* � *<sup>r</sup>* <sup>p</sup> *:* (17)

ð Þ *z* þ *o* þ *r :* (18)

; (15)

*:* (16)

;

;

The regression curve of log dependence log <sup>P</sup>ð Þ *Nr* on log (1/R) is constructed on the basis of the calculations. Fractal dimension D is defined as the tangent of the slope angle of the curve.

When using the triangulation method (TM), the image is divided into identical cells ε of size s � s. Four heights equal to the intensities of pixels in the corners of the cells (a–d) are considered. At the intersection of the diagonals of the cell, the point (e) is set, the value of which is equal to the arithmetic average of four heights. If we represent a cell in the form of a triangular prism, as shown in **Figure 9**, then it is necessary to calculate the area of the projected upper surface, shown in **Figure 8**.

First of all, the values of the sides of the four triangles, obtained by connecting the diagonals of the cell, are calculated (Eqs. (15) and (16)).

**Figure 7.** *Three-dimensional representation of the image with its gray levels [15].*

*Using Algebraic Fractals in Steganography DOI: http://dx.doi.org/10.5772/intechopen.92018*

**Figure 8.** *The projected top surface of a triangular prism.*

#### **Figure 9.**

The differential box-counting (DBC) method takes into account the difference between the maximum and minimum intensity values of the brightness of the image. Let an image be given with the size M � M, which is divided into "boxes" with the size L � L � L<sup>0</sup> (**Figure 7**). The height of the box L<sup>0</sup> divides the third

Space (x, y) of the image containing the values of the coordinates of the peakmudflows is divided into cells of size L � L, after which the maximum and minimum intensity values of (i, j) cell equal to l and k are found, respectively. The next step for each cell is the sum of the differences between the values found (Eq. (13)).

After calculating the amount in all cells is the total amount of differences for the

The regression curve of log dependence log <sup>P</sup>ð Þ *Nr* on log (1/R) is constructed on the basis of the calculations. Fractal dimension D is defined as the tangent of the

When using the triangulation method (TM), the image is divided into identical cells ε of size s � s. Four heights equal to the intensities of pixels in the corners of the cells (a–d) are considered. At the intersection of the diagonals of the cell, the point (e) is set, the value of which is equal to the arithmetic average of four heights. If we represent a cell in the form of a triangular prism, as shown in **Figure 9**, then it is necessary to calculate the area of the projected upper surface, shown in **Figure 8**. First of all, the values of the sides of the four triangles, obtained by connecting

*Nr* <sup>¼</sup> <sup>X</sup> *i*, *j*

the diagonals of the cell, are calculated (Eqs. (15) and (16)).

*Three-dimensional representation of the image with its gray levels [15].*

*nr i*ð Þ,*<sup>j</sup>* ¼ ð Þ *l* � *k* þ 1 *=L*<sup>0</sup> (13)

*nr*ð Þ *i*, *j* (14)

coordinate of the image, which is the intensity value.

where r = L/M is the reduction factor.

entire image (Eq. (14)).

*Fractal Analysis - Selected Examples*

slope angle of the curve.

**Figure 7.**

**94**

*Representation of a cell of the image in the form of a triangular prism.*

$$w = \sqrt{\left(b - a\right)^2 + s^2}; x = \sqrt{\left(c - b\right)^2 + s^2};$$

$$y = \sqrt{\left(d - c\right)^2 + s^2}; z = \sqrt{\left(a - d\right)^2 + s^2};\tag{15}$$

$$o = \sqrt{\left(a - e\right)^2 + \left(\sqrt{2}/2s\right)^2}; p = \sqrt{\left(b - e\right)^2 + \left(\sqrt{2}/2s\right)^2};$$

$$r = \sqrt{\left(c - e\right)^2 + \left(\sqrt{2}/2s\right)^2}; q = \sqrt{\left(d - e\right)^2 + \left(\sqrt{2}/2s\right)^2}.\tag{16}$$

Then, using the Heron formula, the semi-perimeters and areas of all triangles are calculated (Eqs. (17) and (18)).

$$A = \sqrt{s a (s a - w) (s a - p) (s a - o)}; B = \sqrt{s b (s b - x) (s b - p) (s b - q)};$$

$$C = \sqrt{s c (s c - p) (s c - q) (s c - r)}; D = \sqrt{s d (s d - x) (s d - o) (s d - r)}.\tag{17}$$

$$sa = \frac{1}{2} (w + p + o); sb = \frac{1}{2} (x + p + o);$$

$$sc = \frac{1}{2} (y + q + r); sd = \frac{1}{2} (z + o + r). \tag{18}$$

The total surface area is equal to the sum of the areas of individual triangles (Eq. (19)).

*Fractal Analysis - Selected Examples*

$$S\_{ABCD} = A + B + C + D \tag{19}$$

According to the above, you can find the fractal dimension of the color image

When calculating the dimension of color images by the triangulation method, first of all, the particular values of the fractal dimension for each color component

To test the methods for evaluating the fractal dimension, two methods triangulation and DBC were considered. Testing was carried out with the help of fractal objects for which the dimension is known. **Table 2** presents the results of testing the

*<sup>D</sup>* � 100% is the absolute error in estimating the dimension between

*<sup>D</sup>* � 100% is the absolute error in estimating the dimension

*<sup>D</sup>* � 100% is the absolute error of the average estimate of the fractal

**TM ΔTM,% DBC ΔDBC,%** *D* **ΔAV,%**

2.3296 2.2276 4.378 2.4203 3.893 2.3239 0.243

2.3347 2.2260 4.656 2.4068 3.088 2.3164 0.784

2.5 2.3879 4.484 2.5705 2.82 2.4792 0.832

above assessment methods using fractals with a known dimension value.

the measured and the true value of the fractal dimension by the triangulation

between the measured and the true value of the fractal dimension by the DBC

Fractal pyramid 2.3219 2.2641 2.489 2.5524 9.03 2.4083 3.719

Jerusalem cube 2.529 2.3218 8.193 2.5830 2.135 2.4524 3.029

**Name of fractal Illustration D Testing results**

*i*,*j*

*nrg*ð Þþ *<sup>i</sup>*, *<sup>j</sup>* <sup>P</sup>

*i*,*j nrb*ð Þ *i*, *j* <sup>3</sup> (22)

*nrr*ð Þþ *<sup>i</sup>*, *<sup>j</sup>* <sup>P</sup>

Nr{r,g,b} (Eq. (22)).

<sup>Δ</sup>*TM*% <sup>¼</sup> *<sup>D</sup>*^ *TM*�*<sup>D</sup>*

<sup>Δ</sup>*DBC*% <sup>¼</sup> *<sup>D</sup>*^ *DBC*�*<sup>D</sup>*

<sup>Δ</sup>*AV*% <sup>¼</sup> *<sup>D</sup>*�*<sup>D</sup>*

Dodecahedron fractal

3D quadratic Koch

3D quadratic Koch surface (type 2)

*Results of testing methods for measuring the fractal dimension.*

surface

**Table 2.**

**97**

dimension obtained by two methods.

method.

method.

*Nr r*f g ,*g*,*<sup>b</sup>* ¼

*Using Algebraic Fractals in Steganography DOI: http://dx.doi.org/10.5772/intechopen.92018*

> P *i*,*j*

are determined, and then their average value is calculated.

**7. Testing methods for estimating fractal dimension**

In **Table 2**, the following designations are made:

This procedure is repeated for all cell sizes. Then a regression line is constructed, which determines the dependence of the logarithm of the total area of all the triangles log (S) on the logarithm of the cell size log (ε) (**Figure 10**).

To calculate the fractal dimension, it is necessary to find the tangent of the angle of inclination of the constructed curve B. It can be calculated using Eq. (20).

$$B = \frac{r \ast S\_i}{S\_\varepsilon}$$

$$r = \frac{\text{cov}(\varepsilon, S)}{S\_\varepsilon S\_\mathbb{S}}; \text{cov}(e, \mathbb{S}) = \frac{\sum (\varepsilon\_i - \overline{\varepsilon}) \left(\mathbb{S}\_i - \overline{\mathbb{S}}\right)}{N};$$

$$\mathbb{S}\_\varepsilon = \sqrt{\frac{\sum (\varepsilon\_i - \overline{\varepsilon})}{N}}; \mathbb{S}\_\mathbb{S} = \sqrt{\frac{\sum (\mathbb{S}\_i - \overline{\mathbb{S}})}{N}}. \tag{20}$$

*ε*, *S* are the average values of the corresponding parameters. The desired value of the fractal dimension D is calculated by Eq. (21).

$$D = \mathcal{Z} - B \tag{21}$$

In grayscale images, there is only one brightness level of each pixel of the image, while in a color image there are three color values (red, green, and blue) for each pixel of the image. As a result, to estimate the fractal dimension of color images, it is necessary to calculate the dimension for three different color levels. Using the estimation methods of calculating the fractal dimension for images in grayscale, one can calculate the dimension of a color image.

To calculate the dimension of a color image using the DBC method, the same method of calculating dimensions is used as in the grayscale images. In the color image, the dimension is calculated for the red R, green G, and blue B components. According to the DBC technique for each stage (red, green, and blue), you can apply the technique to images in shades of gray. After finding the results of each step, the results of different color levels are combined. As a result, you can get the dimension of the color image:

R: nrr(i,j) = l-k + 1 for red values; G: nrg(i,j) = l-k + 1 for green values; B: nrb(i,j) = l-k + 1 for blue values.

**Figure 10.** *Regression line.*

*Using Algebraic Fractals in Steganography DOI: http://dx.doi.org/10.5772/intechopen.92018*

*SABCD* ¼ *A* þ *B* þ *C* þ *D* (19)

<sup>P</sup>ð Þ *<sup>ε</sup><sup>i</sup>* � *<sup>ε</sup> Si* � *<sup>S</sup>* � �

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi <sup>P</sup> *Si* � *<sup>S</sup>* � � *N*

*<sup>N</sup>* ;

*D* ¼ 2 � *B* (21)

*:* (20)

This procedure is repeated for all cell sizes. Then a regression line is constructed, which determines the dependence of the logarithm of the total area of all the tri-

To calculate the fractal dimension, it is necessary to find the tangent of the angle

*<sup>B</sup>* <sup>¼</sup> *<sup>r</sup>* <sup>∗</sup> *Ss Sε*

; *SS* ¼

In grayscale images, there is only one brightness level of each pixel of the image, while in a color image there are three color values (red, green, and blue) for each pixel of the image. As a result, to estimate the fractal dimension of color images, it is necessary to calculate the dimension for three different color levels. Using the estimation methods of calculating the fractal dimension for images in grayscale, one

To calculate the dimension of a color image using the DBC method, the same method of calculating dimensions is used as in the grayscale images. In the color image, the dimension is calculated for the red R, green G, and blue B components. According to the DBC technique for each stage (red, green, and blue), you can apply the technique to images in shades of gray. After finding the results of each step, the results of different color levels are combined. As a result, you can get the

s

of inclination of the constructed curve B. It can be calculated using Eq. (20).

; covð Þ¼ *ε*, *S*

The desired value of the fractal dimension D is calculated by Eq. (21).

Pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ð Þ *<sup>ε</sup><sup>i</sup>* � *<sup>ε</sup> N*

*ε*, *S* are the average values of the corresponding parameters.

angles log (S) on the logarithm of the cell size log (ε) (**Figure 10**).

*<sup>r</sup>* <sup>¼</sup> covð Þ *<sup>ε</sup>*, *<sup>S</sup> SεSS*

*Fractal Analysis - Selected Examples*

*S<sup>ε</sup>* ¼

can calculate the dimension of a color image.

dimension of the color image:

**Figure 10.** *Regression line.*

**96**

R: nrr(i,j) = l-k + 1 for red values; G: nrg(i,j) = l-k + 1 for green values; B: nrb(i,j) = l-k + 1 for blue values.

r

According to the above, you can find the fractal dimension of the color image Nr{r,g,b} (Eq. (22)).

$$N\_{r\{r,g,b\}} = \frac{\sum\_{i,j} n\_{rr}(i,j) + \sum\_{i,j} n\_{\overline{g}}(i,j) + \sum\_{i,j} n\_{rb}(i,j)}{3} \tag{22}$$

When calculating the dimension of color images by the triangulation method, first of all, the particular values of the fractal dimension for each color component are determined, and then their average value is calculated.
