This application claims priority to Taiwan Application No. 98141141 entitled “Method for Repairing Image” filed on Dec. 2, 2009, which application is incorporated herein by reference.
1. Technical Field
The present invention relates to image processing methods, and more particularly, to an error-containing image repairing method.
2. Description of Related Art
An image or a video comprising a plurality of images incurs errors when subjected to a packet loss or a bit error while being transmitted by a network. Frequently seen image repairing methods, also known as error concealment methods, are of three types, namely a spatial error concealment method, a temporal error concealment method, and a mixed error concealment method.
A spatial error concealment method involves sampling information of a correct block adjacent to an error block in an image so as to repair the error block. In an image, there is likely a high correlation between an error pixel and pixels adjacent thereto in terms of image contents, for example, sharing part of the sky, part of the lawn, or part of the human face. Hence, the pixel values of the top, bottom, left, and right ones of error blocks can be calculated by interpolation, so as to obtain the value of a substitute pixel and treat the value of the substitute pixel as the value of the error pixel. However, sometimes the correlation between adjacent pixels is low; as a result, errors in the values calculated by interpolation are large, thereby compromising the quality of a repaired image. For information related to the spatial error concealment method, see the following literature: S. C. Huang and S. Y. Kuo, “Optimization of Spatial Error Concealment for H.264 Featuring Low Complexity,” Proceedings of the 14th International MultiMedia Modeling Conference (MMM'08), Kyoto, Japan, January 2008, which is incorporated herein by reference.
A temporal error concealment method involves finding appropriate motion vectors by making reference to a previous image for replacing lost or error motion vectors to repair an error block. Frequently seen temporal error concealment methods are, namely zero motion vector method and boundary matching. Zero motion vector method involves finding from a previous image a reference block corresponding in position to an error block and then replacing an error block in a current image with the reference block. Boundary matching involves searching for the most appropriate motion vectors using correct pixels at the boundaries of an error block. However, zero motion vector method has its own disadvantages, such as inaccuracy. Likewise, boundary matching has its own disadvantages, such as intricate computation. For information related to the temporal error concealment method, see the following literature: S. C. Huang and S. Y. Kuo, “Temporal Error Concealment for H.264 Using Optimum Regression Plane,” Proceedings of the 14th International MultiMedia Modeling Conference (MMM'08), Kyoto, Japan, January 2008, which is incorporated herein by reference. A mixed error concealment method entails using temporal and spatial error concealment methods to repair an error block.
The spatial, temporal, and mixed error concealment methods involve generating from the plurality of reference data a substitute data for replacing the error data. However, in case of a low correlation between parts of the reference data and the error data, the quality of a repaired image is likely to be compromised. In view of this, a method for filtering out a reference data can enhance the quality of an image.
It is an objective of the present invention to provide a method for repairing an image. To repair an image, the method applies a statistic method for filtering out reference data so as to enhance the quality of a repaired image.
In an embodiment of the present invention, a method for repairing an image is provided to generate a substitute data to replace an error data in an image. The method comprises the steps of:
Referring to
Step 120 involves generating a predicted value range by a statistic method according to the plurality of reference data. The predicted value range is used to filter out the plurality of reference data, so as to prevent the reference data of a low correlation from being used to repair the error data. Step 130 involves generating a plurality of repairing data according to the predicted value range, wherein values of the plurality of repairing data are within the predicted value range. Finally, step 140 involves generating a substitute data for replacing the error data according to the plurality of repairing data. The application of the method of the present invention in spatial and temporal error concealment methods is described below.
Referring to
Then, step 220 involves generating a predicted value range (Vlow, Vhigh) of a pixel value by applying a statistic method of t distribution or normal distribution according to the values of pixels L1-L8. Vlow denotes the minimum value of the predicted value range. Vhigh denotes the maximum value of the predicted value range. According to statistic principles, the predicted value range (Vlow, Vhigh) covers any specific possible range of pixel values, for example, covering 95% of possible pixel values. Generating a predicted value range by applying a statistic method according to a specific number of samples is a prior art but is not a technical feature of the present invention, and thus it is not described in detail herein.
Step 230 corresponds to step 130 in
Finally, in step 240, the spatial error concealment method involves generating a substitute data for replacing the value of the error pixel using conventional interpolation or other methods with the plurality of repairing data (that is, taking the values of pixels). For example, in the aforesaid embodiment, with pixel p1 being removed, a pixel value for replacing error pixel e1 is generated by interpolation, using the remaining three pixels p2-p4. Several known ways of interpolation are described as follows:
(1) where four pixel values fall within the predicted value range (Vlow, Vhigh), such as pixels p1-p4 that fall within such range as:
where d1-d4 denote the distances between pixels p1-p4 and error pixel e1.
(2) where three pixel values fall within the predicted value range (Vlow, Vhigh), such as pixels p2-p4 that fall within such range as:
(3) where two pixel values fall within the predicted value range (Vlow, Vhigh), such as pixels p2, p4 that fall within such range as:
repairing data=(p2+p4)/2
(4) where one pixel value falls within the predicted value range (Vlow, Vhigh), such as pixel p2 that falls within such range as:
repairing data=p2
Also, where none of the values of the four pixels p1-p4 falls within the predicted value range (Vlow, Vhigh), it is, in an embodiment of the present invention, feasible to treat the average of the maximum value Vhigh and the minimum value Vlow of the predicted value range as a repairing data:
repairing data=(Vlow+Vhigh)/2
In so doing, by applying the image repairing method of the present invention to a spatial error concealment method, reference data of low correlation can be filtered out to enhance the quality of a repaired image.
Referring to
In step 420, a predicted value range is generated by applying a statistic method, such as t distribution or normal distribution, using the values of the plurality of motion vectors MV1-MV8. Since a motion vector has x component and y component, and thus it is feasible to generate the predicted value range (XVlow, XVhigh) of x component and the predicted value range (YVlow, YVhigh) of y component according to the values of the plurality of motion vectors MV1-MV8. Generating a predicted value range by applying a statistic method according to a specific number of samples is a prior art but is not a technical feature of the present invention, and thus it is not described in detail herein.
Step 430 corresponds to step 130 in
Eventually generated is:
Likewise, step 430 also involves generating a plurality of y component repairing data by applying the predicted value range (YVlow, YVhigh) of y component.
Finally, step 440 involves selecting, using a comparing method, one x component repairing data and one y component repairing data as the substitute data, so as to replace values of motion vectors lost by the error block EB2. In an embodiment of the present invention, the comparing method may use a known boundary match algorithm or other comparing methods. For example, the plurality of x component repairing data combines with y component repairing data to form a plurality of motion vectors for selection. The boundary match algorithm finds boundary pixel values in a previous image PI according to the motion vectors, respectively, and calculates the total square difference between each boundary pixel value and the boundary pixel value adjacent to the error block EB2. Finally, the boundary match algorithm selects motion vectors having the total of the least square differences to replace motion vectors lost by the error block EB2. The boundary match algorithm or another comparing method is not a technical feature of the present invention and thus is not described in detail herein.
As revealed in the above description, the image repairing method of the present invention involves generating a predicted value range by a statistic method according to a plurality of sampled reference data of correlation, and then taking the reference data having values within the predicted value range as a repairing data, so as to enhance the quality of a repaired image.
The foregoing preferred embodiments are provided to illustrate the present invention and are not intended to be restrictive of the scope of the present invention. Hence, all equivalent modifications and variations made to the foregoing embodiments without departing from the spirit embodied in the disclosure of the present invention should fall within the appended claims of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
98141141 | Dec 2009 | TW | national |