If p(x, y) were known completely, subtracting p(x, y) from g(x, y) will give f(x, y). In practice, only an approximation of the true pattern can be obtained. The effects of the components that are not considered in the estimation of p(x, y) can be minimized by subtracting g(x, y) by weighted p(x, y), which is given by

f^(x,y)=g(x,y)w(x,y)p(x,y)(4.103)

where w(x, y) is a weighting function. The weighting function w(x, y) can be selected to get optimal results under certain conditions. For example, one approach is to select w(x, y) so that the variance of (x, y) is minimized over a specified neighborhood of every point (x, y). Consider a neighborhood of size (2X + 1) × (2Y + 1) about a point (x, y). The mean and the variance of (x, y) at coordinates (x, y) are

f^¯(x,y)=1(2X+1)(2Y+1)m=XXn=YYf^(x+m,y+n)(4.104)

σ2(x,y)=1(2X+1)(2Y+1)m=XXn=YY[f^(x+m,y+n)f^¯(x,y)]2(4.105)

Substituting eq. (4.103) into eq. (4.105) and assuming w(x, y) remains constant over the neighborhood, eq. (4.105) becomes

σ2(x,y)=1(2X+1)(2Y+1)m=XXn=YY{[g(x+m,y+n)w(x+m,y+n)p(x+m,y+n)][g(x,y)w(x,y)p(x,y)¯]}2(4.106)=1(2X+1)(2Y+1)m=XXn=YY{[g(x+m,y+n)w(x,y)p(x+m,y+n)][g¯(x,y)w(x,y)p¯(x,y)]}2

Solving eq. (4.106), a w(x, y) that minimizes σ2(x, y) is derived as

w(x,y)=g(x,y)p(x,y)¯g¯(x,y)p¯(x,y)p2¯(x,y)p¯2(x,y)(4.107)

4.6Image Repairing

In the process of image acquisition, transmission, and processing, some areas of the image may be damaged (with defect) or even missing, such as the sudden change of pixel gray-values, the loss of important parts. Such situations can have many sources and manifestations:

(1)The missing of partial contents in acquiring the image of scene with object occlusion or scanning the old pictures with damaged parts;

(2)The blank left after removing some specific areas (regardless of the scene contents) in the procedure of image operation;

(3)The appearance alteration induced by the text coverage or by the tearing or scratching of picture;

(4)The loss of partial information caused by image lossy compression;

(5)The loss of certain pixels in the (network) transmission of image due to network failure.

Methods and techniques to solve the abovementioned problems are generally called image inpainting and are closely linked to many image restoration problems.

From a technical point of view, these methods for treating the above problems can be further classified into two groups: inpainting and completion. The former comes from the restoration of museum art works on behalf of the oil painting interpolation in the early days. The latter is also often called region completion, in which some missing areas are filled. The top title for these two groups can be called image repairing.

4.6.1The Principle of Image Repairing

Image repairing is based on the incomplete image and the a prior knowledge of the original image, through the use of appropriate methods to correct or rectify the problem of the region defect in order to achieve the restoration of the original image. Repair can be divided into inpainting and completion. Generally, the repair of small-scale area is called inpainting, while the repair of large-scale area is called completion. Both processes are to restore and complete the damaged or missed information parts in the image, so there are no strict limits on the scale. However, the quantitative change will be caused by qualitative change; the two processes and methods used have their own characteristics from the current technology points of view. Inpainting uses more local structural information of the image rather than the regional texture information, while completion often needs to consider filling the entire image region and makes use of texture information. In terms of function, the former is mostly used for image restoration and the latter for scene object removal and region filling.

It should be pointed out that if there is no prior knowledge of the missing information in the image or the cause of the missing is unknown, the repair of the image is an ill-posed problem, and the solution is uncertain. In practice, the repair of the image often needs to establish a certain model and to make a certain estimate, which are the same for inpainting and completion.

The difficulty or complexity of image repairing (especially completion) comes from three aspects (Chan and Shen, 2005):

(1)Domain complexity: The areas to be repaired will be different with the application domains. For example, in the case of overlay text removal, the area is composed of characters; in the removal of the unwanted object, the area may be of arbitrary shape.

(2)Image complexity: The properties of the image at various scales are different. For example, there are many details/structures at a small scale, while in the large scale the smoothing function approximation can be used.

(3)Pattern complexity: A visually meaningful pattern (high-level meaning) must be considered. Two examples are shown in Figure 4.12. Figure 4.12(a) shows a pair of drawings for filling the center gray patches. When looking at the left drawing, it is reasonable to use a black block for filling; but when looking at the right drawing, the white block is more reasonable to use. Figure 4.12(b) shows a pair of graphs for filling the missing areas of vertical bars. When looking at the aspect ratio in left graph, the vertical bar seems to belong to the background, then the task should be to distinguish between “E” and “3”. When looking at the aspect ratio in right graph, the vertical bar seems to belong to the foreground, then the task should be to recover the partially occluded letter “B”.

Image defect as a special case of image degradation, has its own characteristics. After the image is affected by the imperfection, some of the regions may be completely lost, but other regions may not be changed at all in many cases.

Considering an original image f(x, y), its spatial region of pixel distribution is denoted by F. Let the missing part (the part to be repaired) be d(x, y), its spatial region of pixel distribution is denoted by D. For an image g(x, y) to be repaired, its spatial region of pixel distribution is also F, but some parts remain in the original state and others missing. The so-called repair is to use the information from original state region, that is, FD, to estimate and restore the missing information in D.

One illustration example is given in Figure 4.13, where the left image is the original image f(x, y) and the right image is the image to be repaired g(x, y), in which the region D represents the part to be repaired (the original information are completely lost). The region FD represents the portion of the original image that can be used to repair the region D, also called the source region, and the region D is also called the target region.

With the help of the degradation model shown in eq. (4.8), the model of image repairing can be expressed as

[g(x,y)]FD={H[f(x,y)]+n(x,y)}FD(4.108)

The left side of the equation is the portion of the degraded image that does not degenerate. The goal of image repairing is to estimate and reconstruct {f(x, y)}D by using eq. (4.108). On the one hand, the gray level, color, and texture in the region D should be corresponding to or coordinated with the gray level, color, texture, and so on around the D; on the other hand, the structural information around D should be extended to the interior of D(e. g., the break edges and the contour lines should be connected).

Figure 4.12: Pattern complexity examples.

Figure 4.13: Indication of different regions in image repairing.

Incidentally, if the noise points in the image are regarded as a target region, the image denoising problem may be treated as an image repairing problem. In other words, the gray scale of the pixel affected by the noise is restored by using the pixels not affected by the noise. If the repair of the image affected by the text overlay or the scratches is regarded as the repair of the curvilinear target area and the repair of the area removed from scene image is regarded as the repair of the planar target area, the repair of the image affected by the noise can be considered as the repair of a patchy target area. The above discussion focuses mainly on impulse noise, because the intensity of impulse noise is very big, the superimposition on the image will make the gray scale of the affected pixel become the extreme value, the original pixel information is covered by the noise completely. In the case of Gaussian noise, pixels with noise superimposed often contain still the original grayscale information, while the pixels in the target area of the image are generally no longer contain the original image information (information are removed).

4.6.2Image Inpainting with Total Variational Model

The repair techniques used to remove scratches in target areas that are relatively small in size (including linear or curvilinear areas, smaller in one dimension, such as strokes, ropes, and text) are discussed first. The methods commonly used here are based on partial differential equations (PDE) or variational models, both of which can be equivalently introduced by the variational principle. This kind of image repairing methods achieves the purpose of repairing the image by spreading the target area with a way of pixel by pixel. A typical approach is to propagate from the source region to the target region along an equal intensity line (line of equal gray values) (Bertalmio et al., 2001), which helps preserve the structural properties of the image itself. The total variational (TV) model can be used to recover the missing information in the image. A further improvement is the curvature-driven diffusion (CDD) equation, which is proposed for using the continuity principle that does not hold in the total variational model (Chan and Shen, 2001). The advantage of this method is that the linear structure in the image can be well maintained. The disadvantage of this method is that the details of the image are not always preserved, because the blurring may be introduced in the diffusion process, especially when the large target area is repaired.

4.6.2.1Total Variational Model

The total variational model is a basic and typical image repair model. The total variational algorithm is a non-isotropic diffusion algorithm that can be used to denoise while preserving edge continuity and sharpness.

Defining the cost function of diffusion as follows:

R[f]=F|f(x,y)|dxdy(4.109)

where ∇f is the gradient of f. Consider the case of Gaussian noise, in order to remove noise, eq. (4.109) is also subject to the following constraints

1FDFD|fg|2dxdy=σ2(4.110)

where ||FD|| is the area of the region FD, and σ is the noise mean square error. The objective of eq. (4.109) is to repair the region and to keep its boundary as smooth as possible, while the function of eq. (4.110) is to make the repairing process robust to noise.

With the help of Lagrangian factor λ, eq. (4.109) and eq. (4.110) can be combined to convert the constrained problem into the unconstrained problem

E[f]=F|f(x,y)|dxdy+λ2FD|fg|2dxdy(4.111)

If the extended Lagrangian factor λD is introduced,

λD(r)={0rDλr(FD)(4.112)

The functional (4.111) becomes

J[f]=F|f(x,y)|dxdy+λD2F|fg|2dxdy(4.113)

According to the variational principle, the corresponding energy gradient descent equation is obtained

ft=[f|f|]+λD(fg)(4.114)

In eq. (4.114), ∇ • represents the divergence.

Equation (4.114) is a nonlinear reaction-diffusion equation with a diffusion coefficient of 1/|∇f|. Within the region D to be repaired, λD is zero, so eq. (4.114) degenerates into a pure diffusion equation; while around the region D to be repaired, the second term of eq. (4.114) makes the solution of the equation tending to the original image. The original image can be finally obtained by solving the partial differential equation eq. (4.114).

Figure 4.14: Image inpainting for removing overlay text.

Example 4.6 Image inpainting

A set of images in Figure 4.14 gives an example of image inpainting for removing overlay text. The first three images, from left to right, are the original image, superimposed text image (to be repaired image), and the results of inpainting. The rightmost image is the difference image (equalized by histogram equalization for display) between the original image and the inpainting result image, where the PSNR between the two images is about 20 dB.

4.6.2.2Hybrid Models

In the total variational model described above, diffusion is only performed in the orthogonal direction of the gradient (i. e., the edge direction), not in the gradient direction. This feature of the total variational model preserves the edge when the diffusion is near the contour of the region; however, in the smooth position within the region, the edge direction will be more random, and the total variation model may produce false contours due to noise influence.

Consider that the gradient term in the cost function is substituted by the gradient square term in the total variational model

R[f]=F|f(x,y)|2dxdy(4.115)

and in addition, eq. (4.110) is also used for transforming the problem into an unconstrained problem. Then, by using the extended Lagrangian factor of eq. (4.112), a functional can be obtained

J[f]=F|f(x,y)|2dxdy+λD2F|fg|2dxdy(4.116)

This results in a harmonic model. Harmonic model is an isotropic diffusion, in which the edge direction and gradient direction are not be distinguished, so it can reduce the impact of noise generated by false contours, but it may lead to a certain fuzziness for the edge.

A hybrid model of weighted sums of two models takes the gradient term in the cost function as

Rh[f]=Fh|f(x,y)|+(1h)2|f(x,y)|2dxdy(4.117)

where, h [0, 1] is the weighting parameter. The functional of the hybrid model is

Jh[f]=Fh|f(x,y)|+(1h)2|f(x,y)|2dxdy+λD2F|fg|2dxdy(4.118)

Comparing eq. (4.109) with eq. (4.118) shows that when h = 1, eq. (4.118) is the total variational model.

Another hybrid model combining the two models is the p-harmonic model, where the gradient term in the cost function is

Rp[f]=F|f(x,y)|pdxdy(4.119)

where, p [1, 2] is the control parameter. The functional of the p-harmonic model is

Jp[f]=F|f(x,y)p|dxdy+λD2F|fg|2dxdy(4.120)

Comparing eq. (4.113) with eq. (4.120) shows that when p = 1, eq. (4.120) is the total variational model. Comparing eq. (4.116) with eq. (4.120) shows that when p = 2, eq. (4.120) is the p-harmonic model. Thus, selecting 1 < p < 2 could achieve a better balance between the two models.

4.6.3Image Completion with Sample-Based Approach

The method described in the previous section is more effective for repairing missing regions with small dimensions, but there are some problems when the missing region is large. On the one hand, the method of the previous section is to diffuse the information around the missing region into the missing region. For the larger scale missing region, the diffusion will cause a certain blur, and the blur degree increases with the scale of the missing region. On the other hand, the method of the previous section does not take into account the texture characteristics inside the missing region, and moves the texture characteristics around the missing region directly into the missing region. Because of the large size of the missing regions, the texture characteristics inside and outside may have a greater difference, so the repair results are not ideal.

The basic ideas to solve the above problems include the following two kinds:

(1)Decomposing the image into structural parts and texture parts, the diffusion method described in the previous section can still be used to fill the target region having the strong structure, while for the regions with strong texture the filling will be made with the help of technology of texture synthesis.

(2)Selecting some sample blocks in the nondegraded portion of the image, and using these sample blocks to replace the blocks at the boundary of the region to be filled (the blocks in the nondegraded portions of the image have characteristics close to those boundary blocks). By repeating the filling process progressively toward the inside of the region to be filled to achieve image completion.

The first approach is based on a hybrid approach. Because the natural image is composed of texture and structure, the diffusion method using the structural information is reasonable. However, only using texture synthesis to fill large target region has still some risk and difficulty.

The method based on the second idea is often referred to as sample-based image completion method. Such a method directly fills the target region with information from the source region. This idea is enriched by texture filling. It searches in the source region, to find the image blocks most similar to the image block in the target region, and to fill these target blocks by direct substitution.

Compared with the PDE-based diffusion method, the sample-based approach often achieves better results in filling texture content, especially when the scale of the target region is large.

The sample-based image completion method uses the original spatial region to estimate and fill the missing information in the part to be repaired (Criminisi et al., 2003). To this end, a grayscale value is assigned to each pixel in the target region (zero can be used to represent pixel to be filled). In addition, a confidence value is also assigned to each pixel of the target region. The confidence value reflects the degree of confidence in the gray value of the pixel and is no longer changed after the pixel is filled. On the other hand, a temporary priority value is assigned to the image blocks on the filling fronts during the filling process, to determine the order in which the image blocks are filled. The entire filling process is iterative, including three steps.

4.6.3.1Calculating the Priority of the Image Block

For larger target regions, the process of filling the image block is conducted from the outside to inside. A priority value is calculated for each image block on the filling front, and the filling order for the image blocks is then determined based on the priority value. Considering the need to keep the structure information, this value is relatively large for image blocks that are located on consecutive edges and surrounded by high confidence pixels. In other words, a region with a stronger continuous edge (human is more sensitive to edge information) has the priority to fill, and a region whose more information are known (which is more likely to be more correct) has also the priority to fill.

The priority value of the image block P(p) centered on the boundary point p can be calculated as follows:

P(p)=C(p)D(p)(4.121)

In eq. (4.121), the first term C(p) is also called the confidence term, which indicates the proportion of the perfect pixels in the current image block; the second term, D(p) is also called the data item, which is the inner product of the iso-illuminance line at point p(line of equal gray value) and the unit normal vectors. The more numbers the perfect pixels in the current image block, the bigger the first term C(p). The more consistent the normal direction of the current image block with the direction of the iso-illuminance line, the bigger the value of the second term D(p), which makes the algorithm to have higher priority to fill the image blocks along the direction of the iso-illuminance line, so that the repaired image can keep the structure information of the target region well. Initially, C(p) = 0 and D(p) = 1.

4.6.3.2Propagating Texture and Structure Information

When the priority values are calculated for all image blocks on all the fronts, the image block with the highest priority can be determined and then it can be filled with the image block data selected from the source region. In selecting the image blocks from the source region, the sum of squared differences of the filled pixels in the two image blocks should be minimized. In this way, the result obtained from such a filling could propagate both the texture and the structure information from the source region to the target region.

4.6.3.3Updating the Confidence Value

When an image block is filled with new pixel values, the already existing confidence value is updated with the confidence value of the image block where the new pixel is located. This simple update rule helps to measure the relative confidence between image blocks on the frontline.

A schematic for describing the above steps is given in Figure 4.15. Figure 4.15(a) gives an original image, where T represents the target region, both S(S1 and S2) represent source regions, and both B(B1 and B2) represent the boundaries between the target region and two source regions, respectively. Figure 4.15(b) shows the image block Rp to be filled, which is currently centered on p on B. Figure 4.15(c) shows two candidate image blocks found from the source regions, which can be used for filling. One of the two blocks, Ru, is at the junction of two regions that can be used for filling (similar with the block to be filled), while the other, Rv, is in the first region that can be used for filling (has a larger gap with the block to be filled). Figure 4.15(d) gives the result of the partial filling by using the nearest candidate block (here Ru, but some combinations of multiple candidate image blocks are also possible) to Rp. The above-described filling process can be performed sequentially for all the image blocks in T, and the target region can be finally filled with the contents from source region.

Figure 4.15: Structure propagation schemes based on sample texture filling.

Figure 4.16: Image completion for removing unwanted object.

In the filling process, the image blocks can be sequentially selected following the order of peeling onion skin, that is, from outside to inside, ring-by-circle order. If the boundary point of the target region is the center of the image block, the pixels of the image region in the source region are known, and the pixels in the target region are unknown and need to be filled. For this reason, it is also considered to assign weights to the image blocks to be repaired. The more numbers of known pixels are included, the greater the corresponding weights are, and the larger the number of known pixels, the higher the repair order.

Example 4.7 Image completion

A set of images in Figure 4.16 gives an example of removing the (unwanted) object from the image. From left to right are given the original image, the image marking the scope of the object to be removed (image needing to repair) and the image of repair results. Here the object scale is relatively large than text strokes, but the visual effect of repair is relatively satisfactory.

4.7Problems and Questions

4-1Make an analytic comparison of the effect of neighborhood averaging for removing Gaussian noise, uniform noise, and impulse noise (with the help of their probability density functions).

4-2*Assume that the model in Figure 4.5 is linear and position-invariant. Show that the power spectrum of the output is |G(u, v)|2 = |H(u, v)|2|F(u, v)|2 + |N(u, v)|2.

4-3Consider a linear position invariant image degradation system with impulse response h(xs, yt) = exp {−[(xs)2+ (yt)2]}. Suppose that the input to the system is an image consisting of a line of infinitesimal that is located at x = a and modeled by f(x, y) = δ(xa). What is the output image g(x, y) if no noise exists?

4-4Suppose an object has the moving components in a direction that has an angle of 45° with respect to the X direction, and the motion is uniform with a velocity of 1. Obtain the corresponding transfer function.

4-5Suppose that an object has a uniform velocity movement in the X direction for a period of Tx. Then it has a uniform velocity movement in the Y direction for a period of TY. Derive the transfer function for these two periods.

4-6Suppose that the uniform acceleration movement of an object in the X direction causes the blurring of an image. When t = 0, the object is in a still state. During the period of t = 0 to t = T, the acceleration of the object movement is x0(t) = at2/2. Obtain the transfer function H(u, v) and compare the characteristics of the uniform velocity movement and the uniform acceleration movement.

4-7Image blurring caused by long-term exposure to atmospheric turbulence can be modeled by the transfer function H(u, v) = exp[–(u2+ v2)/2σ2]. Assume the noise can be ignored. What is the equation of the Wiener filter for restoring the blurred image?

4-8*Suppose that a blurring degradation of an imaging system can be modeled by h(r) = [(r2– 2σ2)/σ4] exp[–r2/2σ2], where r2 = x2+ y2. Find out the transfer function of a constrained least square filter.

4-9Using the transfer function in the above problem, give the expression for a Wiener filter. Assume that the ratio of the power spectra of the noise and the undegraded signal is a constant.

4-10Suppose that an image is superimposed by a 2-D sinusoidal interference pattern (with a horizontal frequency of 150 Hz and a vertical frequency of 100 Hz).

(1)What is the difference between the degradation caused by this interference and the degradation caused by the uniform velocity movement?

(2)Write out the expression for the Butterworth band-pass filter of order 1 (with a cutoff frequency of 50 Hz), which complements the band-rejecting filter for eliminating this interference.

4-11In many concrete image restoration applications, the parameters used in restoration techniques should be adapted to the a priori knowledge of the application. Search in the literature and find what types of a priori knowledge can be used.

4-12 (1)For the two images shown in Figure Problem 4-12, discuss on which image is relatively easy to repair and to achieve good result without leaving traces of the effect, and why?

(2)Try to repair them by running an algorithm, and compare the results.

Figure Problem 4-12

4.8Further Reading

1.Degradation and Noise

Further discussions on noise can be found in Libbey (1994). Particular descriptions on the probability density functions of Rayleigh noise, Gamma noise, and exponential noise can be found in Gonzalez and Woods (2008).

Discussion on the degradations related to the optical systems during the image capturing process can be found in Pratt (2001).

One method for noise estimation in an image can be found in Olsen (1993).

Impulse noise can be removed parallely (Duan and Zhang, 2011).

2.Degradation Model and Restoration Computation

Further discussion on various properties of matrices can be found in Committee (1994) and Chen and Chen (2001).

More explanation for image restoration can be found in several textbooks; for example, Gonzalez and Woods (2008).

Image blurring is one type of image degradation process. A technique based on neural networks to identify and restore a blurred image can be found in Karnaukhov et al. (2002).

3.Techniques for Unconstrained Restoration

Using a sequence of low-resolution images to reconstruct a high-resolution image is called super-resolution reconstruction, which is also an image restoration technique (Tekalp, 1995).

4.Techniques for Constrained Restoration

More discussion on constrained restoration can be found in Castleman (1996) and Gonzalez and Woods (2008).

5.Interactive Restoration

Details for deriving related formulas can be found, for example, in Bracewell (1995).

6.Image Repairing

A general introduction for image repairing can be found in Zhang (2015b).

Using sparse representation for image repairing can be found in Shen et al. (2009).

Using nonnegative matrix factorization and sparse representation for image repairing can be found in Wang and Zhang (2011).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.202.4