Quantized image pseudo contour elimination method, terminal device, storage medium and computer program product
By pre-quantizing the original image and determining the connected set features, combined with the primary mapping and secondary mapping methods, the problems of low detection accuracy and slow speed in the removal of false contours in quantized images are solved, and efficient and low-noise false contour removal effects are achieved.
Patent Information
- Application Number
- CN202410472638.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2044-04-18
AI Technical Summary
Existing methods for eliminating false contours in quantized images have the problems of low false contour detection accuracy, slow processing speed, and easy introduction of additional noise.
The original image that has not been quantized is obtained for pre-quantization processing. The candidate areas of false contours are located by combining the judgment algorithm based on connected set features, and primary and secondary mapping are performed. The average weight filter kernel and connected set expansion processing are used to count the number of pixels and judge the difference. Finally, secondary mapping is performed to eliminate the false contours.
The method can effectively eliminate the pseudo contours of quantized images, improve the processing speed, reduce noise interference, and maintain the visual quality of the image.
Smart Images

Figure CN118283282B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method for eliminating pseudo contours of a quantized image, a terminal device, a storage medium and a computer program product. Background Art
[0002] Image quantization reshapes the dynamic range of a real image by reducing the image bit depth, thereby reducing the amount of data required for image transmission or storage. The pseudo-contour problem is a form of distortion often encountered in quantized images, especially when the original image is a computer-generated image or a high-quality photographic image with gradient shading. This problem occurs when the smooth gradient areas of the image are distorted to look like contour maps rather than maintaining the smooth appearance of the area. This problem manifests as a phenomenon of brightness and color jumps. The pseudo-contour areas of the quantized image appear as steps rather than smooth slopes. Each step forms a visible edge that did not exist in the original image, thus damaging the visual quality of the image.
[0003] Existing methods for eliminating pseudo contours in quantized images mainly eliminate or mitigate the pseudo contour problem by analyzing the quantized image features and performing post-processing such as filtering. However, these methods are prone to technical bottlenecks such as low pseudo contour detection accuracy, slow processing speed caused by cyclic operations such as filtering, and the introduction of additional noise. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for eliminating false contours in a quantized image, a terminal device, a storage medium, and a computer program product to solve the above-mentioned technical problems. To this end, the technical solution adopted by the present invention is as follows:
[0005] According to a first aspect of the present invention, a method for eliminating false contours in a quantized image is provided, which may include the following steps:
[0006] S1, obtaining the original image that has not been quantized and performing pre-quantization processing;
[0007] S2. Locate the pseudo contour candidate area in the original image based on the pre-quantized image and the judgment algorithm based on the connected set feature;
[0008] S3, mapping the pseudo contour candidate area of the original image that has not been quantized before formal quantization;
[0009] S4, formally quantizing the mapped image for transmission or storage;
[0010] S5. Extract the area to be remapped from the formally quantized image that has been called after transmission or storage, perform remapping, and complete the pseudo contour elimination process.
[0011] In an embodiment of the present invention, S2 includes:
[0012] S21, performing convolution filtering and connected set expansion processing on the pre-quantized image using an average weighted filter kernel;
[0013] S22, aggregate the sub-connected sets into a mother connected set;
[0014] S23, determining whether the pixel value difference between any two adjacent sub-connected sets in each mother connected set is equal to a set value, and discarding the mother connected sets for which the above determination result is no;
[0015] S24, counting the number of pixels of the sub-connected sets in each mother connected set, and sorting the pixel numbers from small to large, comparing the median of the pixel numbers with the mother connected set determination threshold M, and if it is less than M, discarding the mother connected set;
[0016] S25. According to the coordinate ranges of all non-discarded mother connected sets in the pre-quantized image, extract the pseudo-contour candidate area in the original image that has not been quantized; and according to the coordinate ranges of each child connected set contained in all mother connected sets in the pre-quantized image, extract a subset of pixel areas in the pseudo-contour candidate area of the original image.
[0017] In the embodiment of the present invention, the threshold M is set to 0.01% to 0.05% of the total pixel value of the image.
[0018] In an embodiment of the present invention, S3 includes:
[0019] S31, performing color scale division on a subset of pixel regions in the pseudo contour candidate region;
[0020] S32, calculating a mapping target value of each color level pixel;
[0021] S33, mapping the pixels in the pseudo contour candidate area.
[0022] In an embodiment of the present invention, S5 includes:
[0023] S51, using the quantized and marked connected sets to perform seed growth, complete the determination and aggregation of connected sets, and extract the area to be remapped;
[0024] S52 , calculating the secondary mapping target pixel value of each pixel in the area to be secondary mapped, and completing the secondary mapping to eliminate the pseudo contour problem of the image.
[0025] According to a second aspect of the present invention, a terminal device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method for eliminating pseudo contours in quantized images as described above.
[0026] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program / instruction is stored, wherein the computer program / instruction, when executed by a processor, implements the steps of the method for removing false contours from a quantized image as described above.
[0027] According to a fourth aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method for removing false contours from a quantized image as described above.
[0028] The present invention systematically analyzes and applies the image features before and after quantization, and solves the problems of poor pseudo contour elimination effect and high computing power requirements in traditional quantized image pseudo contour elimination technology through linear operations such as data-based mapping that do not require loops. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a flow chart of a method for eliminating pseudo contours in quantized images according to the present invention;
[0030] Figure 2 A schematic diagram of the filtering, determination, and expansion process of a pseudo contour candidate area provided by an embodiment of the present invention;
[0031] Figure 3 A schematic diagram of a method for performing primary mapping and secondary mapping provided in an embodiment of the present invention;
[0032] Figure 4 Schematic diagram of the process of determining and aggregating related connected sets in the area to be remapped provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the objects, features and advantages of the present invention can be more clearly understood. It should be understood that the embodiments shown in the accompanying drawings are not intended to limit the scope of the present invention, but are only intended to illustrate the essential spirit of the technical solution of the present invention.
[0034] In the following description, for the purpose of illustrating the various disclosed embodiments, certain specific details are set forth in order to provide a thorough understanding of the various disclosed embodiments. However, those skilled in the relevant art will recognize that the embodiments may be practiced without one or more of these specific details. In other cases, well-known devices, structures, and techniques associated with this application may not be shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.
[0035] Unless the context requires otherwise, throughout the specification and claims, the word "comprise" and variations such as "include" and "have" should be construed in an open, inclusive sense, that is, should be interpreted to mean "including, but not limited to."
[0036] Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any manner in one or more embodiments.
[0037] As used in this specification and the appended claims, the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It should be noted that the term "or" is generally employed in its sense including "and / or" unless the context clearly dictates otherwise.
[0038] like Figure 1 As shown, the first embodiment of the present invention provides a method for eliminating false contours in a quantized image, which may include the following steps:
[0039] S1. Obtain the original image that has not been quantized and perform pre-quantization. Specifically, obtain the grayscale image f that has not been quantized. After f is quantized by n bits, it forms the image f0. The above quantization operation is the pre-quantization process. Among them, performing n-bit quantization means setting the lowest n bits of the x-bit binary pixel value of each pixel of the grayscale image with an x-bit depth to zero. Usually, the pixel value of the image is 8-bit data, that is, the pixel value range is [0, 2 8 -1[. The variables f, f0, n, and x defined above are used in S2 to S4.
[0040] S2. Locate the pseudo-contour candidate regions in the original image based on the pre-quantized image and a determination algorithm based on connected set features. Specifically, based on the pre-quantized image f0, a determination algorithm based on connected set features is used to locate pixel regions in f that may produce pseudo-contours. The pixel regions in f that may produce pseudo-contours are pseudo-contour candidate regions. The pseudo-contour candidate regions contain several connected components, each of which has relatively rich pixel value segmentation differences before quantization. After quantization, a large number of segmented pixel values are processed into a unified pixel value.
[0041] Specifically, step S2 includes the following steps:
[0042] S21. Use the weighted filter kernel [1 / 9, 1 / 9, 1 / 9; 1 / 9, 1 / 9, 1 / 9; 1 / 9, 1 / 9; 1 / 9] to perform convolution filtering on each pixel of the pre-quantized image f0, and extract the pixel points whose pixel values remain unchanged after filtering as a certain number of 8-connected sets of pixels. Perform regional extension of 1 pixel value on the extracted 8-connected sets, that is, use the weighted filter kernel [1, 1, 1;] to expand each 8-connected set. In particular, the image area that may have pseudo-contour problems after quantization has a smooth pixel value increasing or decreasing transition trend before quantization, that is, the pixels contained therein have a small step-by-step progressive relationship of values in a specific direction, such as Figure 2 The pixel value matrix shown in (a) represents an unquantized image (8-bit depth) area where pseudo contours may appear. The pixel matrix has 16*16 pixel elements, and the pixel values of the pixels contained are [0,1,2,3,4,5,6,7]. There is a trend of increasing pixel values with a step of 1 from the center to the periphery. Figure 2 As shown in (b), because the binary representation of the pixel values contained in the pixel value matrix is [000, 001, 010, 011, 100, 101, 110, 111], if the pixels contained in the pixel value matrix are quantized by n=2 bits, that is, the lowest two bits of the binary values corresponding to the pixel value matrix are zeroed to become [000, 000, 000, 000, 100, 100, 100, 100], the corresponding decimal matrix pixel values are [0, 0, 0, 0, 4, 4, 4, 4]. The final quantized image only forms two adjacent pixel sets containing pixel values 0 and 4, respectively, and loses the smooth pixel slope in the original image and becomes an obvious pixel value step, which causes the pseudo contour phenomenon. For example, Figure 2 The pixel value of point p1 shown in (b) is 0 and is filtered with the weighted average filter kernel. Its pixel value changes to (4*(1 / 9))+(4*(1 / 9))+(4*(1 / 9))+(0*(1 / 9))+(0*(1 / 9))+(0*(1 / 9))+(0*(1 / 9)+(0*(1 / 9))+(0*(1 / 9))=1.3, which is different from the original image value. Therefore, p1 is not a pixel point whose pixel value remains unchanged after filtering. Figure 2 The pixel value of point p2 shown in (b) is 0. After filtering in the same way, the pixel value of point p2 is still 0. Therefore, point p2 is a pixel whose pixel value remains unchanged after filtering. Figure 2 As shown in (c), the quantized Figure 2The pixel points in (b) whose pixel values remain unchanged after filtering form two 8-connected components, set1 and set2, in which point p1 is outside the connected component and point p2 is inside the connected component. In particular, point p1 is generally located at the intersection of two pseudo-contour step areas, and point p2 is located inside the pseudo-contour area. If you want to include pixels at the intersection of the step areas but with the same pixel values as those inside the steps into the connected components, you need to extend each connected set area by several pixels. Because the selected filter kernel is 3*3 in size, the edge of each pseudo-contour step is 1 pixel, which means that the connected set area needs to be extended by 1 pixel. If you choose a filter kernel of other sizes, you need to change the number of extended pixels of the connected set area accordingly. Take the median of the pixels contained in each connected set as the pixel value of each connected set. Figure 2 As shown in (d), Figure 2 After the connected components set1 and set2 located in (c) are extended by one pixel, set1 includes the pseudo contour steps. Figure 2 (b) All pixels with a value of 4, set2 includes the pseudo-contour steps Figure 2 (b) All pixels have a value of 0. That is, the pixel value of set1 is 4 and the pixel value of set2 is 0.
[0043] S22. Aggregate 8-connected sets with m adjacent pixels. That is, if an 8-connected set contains at least m pixels and has an 8-connected relationship with at least one of the m pixels in another 8-connected set, then merge the two 8-connected sets into a larger connected set. The original 8-connected set before aggregation is designated as a child connected set, and the larger connected set after aggregation is designated as a parent connected set.
[0044] S23, determine whether the pixel value difference between any two adjacent sub-connected sets in each mother connected set is 2 n . Discard the mother connected sets whose above judgment results are negative. Figure 2 As shown in (d), if set1 and set2 are adjacent 8-connected sets, after n=2 bit quantization, the pixel difference between set1 (pixel value is 4) and set2 (pixel value is 0) is 4=2 2 . Then it is considered that the two adjacent connected sub-sets set1 and set2 are the ones whose pixel value difference is 2 n .
[0045] S24, count the number of pixels of the sub-connected sets in each mother connected set, sort the number of pixels from small to large, compare the median of the number of pixels with the mother connected set judgment threshold M, if it is less than M, then discard the mother connected set. iFor images of this type, the values of M are v% of the total pixel value of the image. After a large number of experiments, the v values that have a good processing effect on images of various mainstream resolutions are shown in Table 1.
[0046] Table 1
[0047] sequence Resolution v <![CDATA[res1]]> 540p 0.05 <![CDATA[res2]]> 720p 0.035 <![CDATA[res3]]> 1080p 0.025 <![CDATA[res4]]> 2k 0.02 <![CDATA[res5]]> 4k 0.015
[0048] S25. Extract the pseudo contour candidate region T in the grayscale image f that has not been quantized according to the coordinate ranges of all the undiscarded mother connected sets in f0; extract ka pixel region subsets T in the pseudo contour candidate region T of f according to the coordinate ranges of the sub-connected sets contained in all the mother connected sets in f0. i , that is, T={T1,T2,…T ka}, where ka is the total number of pixel region subsets contained in the pseudo contour candidate region. If there is no undiscarded mother connected set, it is considered that f does not produce a pseudo contour effect after n-bit quantization or the pseudo contour effect produced is not sufficient to affect the visual perception of the image, and subsequent pseudo contour removal processing will not be performed.
[0049] S3. Mapping the pseudo contour candidate region of the original image that has not been quantized before formal quantization.
[0050] Specifically, S3 includes the following steps:
[0051] S31 , performing color scale division on a subset of pixel regions in the pseudo contour candidate region.
[0052] Before formally quantizing the image, each pixel region subset T in the pseudo contour candidate region contained in f is i The pixel values involved in each are divided into the color level set E in order from small to large i ={E i(1) ,E i(2) ,…E i(o)}, where i is the sequence label of the pixel subset, o is the total number of pixel values involved in the pixel region subset, and each pixel value is a color level. The pixel region subset T is calculated by the following formula i The initial quantized value q i .
[0053]
[0054] Among them, ceil is the logarithm rounded up, d i For the color level set E i The median of the elements.
[0055] like Figure 3 As shown, Figure 3(a) shows a subset of pixels extracted from the pseudo-contour candidate region in f, where the pixel bit depth is x = 8 bits and there are o = 4 different pixel values. These o pixel values are sorted from smallest to largest and incorporated into the color scale set E = {96, 97, 98, 99}. If quantization is subsequently performed with n = 2 bits, the median of the color scale set is d = 97.5, and the initial quantization value q = 100 is calculated for this subset of pixels.
[0056] Set each color level E i The elements in are divided into n subgroups according to the size of each spa element as a subgroup, forming a subgroup set R = {R1, R2, ... R n}, where R b The number of elements in can be less than spa, n and spa are calculated by the following formula:
[0057]
[0058] If Figure 3 The color scale set E = {96, 97, 98, 99} corresponding to the pixel region subset shown in (a) is divided into n = 2 subgroups. Each subgroup contains spa = 2 color scales, i.e., color scale subgroup R1 contains color scales {98, 99}, and color scale subgroup R2 contains color scales {96, 97}
[0059] S32, calculate the first mapping target value of each color level pixel. i , compare the color levels contained in each color level subgroup in the pixel area subset T i The number of pixels corresponding to the value in , and the minimum value is recorded as r min . Set the mapping target value array H={H1,H2,…H n}, where H i R i The color levels contained in T i The target mapping value of the corresponding pixel is calculated as follows:
[0060] H i =q i +(i-2)2 n ,H i ≥0
[0061] like Figure 3 The target values of the first mapping values corresponding to the two color scale subgroups R1 and R2 in (a) are Figure 3 In (b), H1=100, H2=96.
[0062] S33, T iThe pixel values of the corresponding pixels are divided into color scale subgroups to determine the corresponding primary mapping target values and then mapped, that is, the pixel values of the pixel area subset are mapped once before formal quantization.
[0063] The image processed in this step will be severely distorted after quantization. Therefore, a secondary mapping is required before the image data is finally used to restore the original feature information of the image.
[0064] S4. Formal quantization is performed on the mapped image for transmission or storage.
[0065] S5. Extracting the area to be remapped from the transferred or stored image after formal quantization and performing remapping to eliminate false contours. Because the image data that has been mapped once before formal quantization contains encoded values that significantly deviate from the original image feature information, it is necessary to relocate the image area that has been mapped once after formal quantization and perform remapping to restore the original image feature information.
[0066] Specifically, S5 includes the following steps:
[0067] S51 , using the quantized and marked connected sets to perform seed growth, completing the determination and aggregation of connected sets, and extracting the area to be remapped.
[0068] After a mapping and formal quantization, pixels with equal values in the image are processed with 8-connectivity to obtain several connected sets. The connected sets that meet the following two conditions are judged and selected one by one and classified into the set W = {W1, W2, ... W kw The above judgment conditions are: (1) The total number of pixels contained in the connected set is not less than r min ; (2) Each connected domain contains at least 3 neighbors.
[0069] According to the quantized image characteristics, the grayscale value of all pixels in the image is z*2 n , z=1,2,3,… x . Each connected set W that satisfies the above judgment conditions i The mark is the z value corresponding to its pixel value, and all the z values used for marking are sorted from small to large into the mark value set Z = {Z1, Z2, ... Z kz}, where kz is the number of label values involved in all connected sets.
[0070] Set the first connected set with a label value of Z1 (denoted as SET(Z1)) as a candidate connected set to be remapped, detect the label values of its neighbors one by one, merge the first neighbor with a label value of Z1+1 into the candidate connected set to be remapped, and update its label value to Z1+1. Continue n-1 neighborhood label value determination and aggregation operations in the above manner. If the operation stops, the candidate connected set to be remapped does not have a neighbor with a label value greater than 1; then the candidate connected set to be remapped is the first target connected set we want to obtain, and the detection and aggregation path of this connected set is l1. Return to SET(Z1), and confirm that all neighbors passing through the path l in the above manner. i The target connected set formed is aggregated to form a connected set to be secondary mapped that is grown with SET(Z1) as the seed.
[0071] like Figure 4 (a), (b), and (c) contain the same set of image connected sets that have been formally quantized and labeled, and the connected sets are labeled [6, 8, 9, 10, 11]. Among them, the connected set labeled 8 in the upper left corner of each image is the seed. Figure 4 The relevant connected sets in (a) are determined by path l1 and aggregated into target connected set 1. Figure 4 The relevant connected sets in (c) are determined by path l2 and aggregated into target connected set 2. Figure 4 (c) Aggregate the target connected set 1 and the target connected set 2 into a connected set to be remapped. Repeat the above connected set determination and aggregation operations for other connected sets marked as Z1.
[0072] Set the mark value to Z2~Z kz -3 all connected sets repeat the connected set determination and aggregation operation, and get the connected sets marked as Z1~Z kz The connected sets of -3 are all the connected sets to be quadratically mapped for the growth of the seed.
[0073] S52 , calculating the secondary mapping target pixel value of each pixel in the area to be secondary mapped, and completing the secondary mapping to eliminate the pseudo contour problem of the image.
[0074] All connected sets to be remapped are classified into the set of regions to be remapped T2 = {T21, T22, ... T2 kt2}, that is, the area to be remapped, where kt2 is the number of connected sets in the area to be remapped. In this way, each connected set T2 i Contains n arithmetic difference mark values with a difference of 1, and the arithmetic difference mark values are divided into set R2 in ascending order. i ={R2 i(1) ,R2 i(2) ,…R2 i(n)}, set the secondary mapping target value array H2 = {H21, H22, ... H2n}, among which H21, H2 n Calculated by the following formula: H21 = 2 n R2 i(1) ,H2 b =2 n R2 i(b) ;H2 i , i=2,3,…n-1, calculated by the following formula:
[0075]
[0076] R2 i Mid-tones at T2 i The pixel value of the corresponding pixel is mapped to H2 i, , completing the secondary mapping of the formally quantized image to form the quantized de-contoured image f_final.
[0077] like Figure 3 As shown, the target connected set has four levels of pixel value difference before quantization. If quantization is directly performed with n=2, all data differences will be lost, resulting in a staircase in the pseudo-contour area. Using the invention to restore the quantized data, the original numerical features of the target area are effectively preserved, and the pixel value difference of two levels is formed.
[0078] According to a second embodiment of the present invention, a terminal device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method for removing false contours from quantized images as described above.
[0079] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0080] Terminal devices can be computing devices such as smartphones, desktop computers, laptops, PDAs, and cloud servers. Terminal devices may include, but are not limited to, processors and memory. For example, they may also include input / output devices, network access devices, and buses.
[0081] The processor may be a central processing unit (CPU), other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device and connects various parts of the entire terminal device using various interfaces and lines.
[0082] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0083] A third embodiment of the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction, when executed by a processor, implements the steps of the method for removing false contours from a quantized image as described above.
[0084] If the various modules / units of the terminal device are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program to instruct the relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0085] A fourth embodiment of the present invention provides a computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the method for removing false contours from a quantized image as described above are implemented.
[0086] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, terminal devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0087] While the preferred embodiments of the present invention have been described in detail above, it should be understood that, after reading the above teachings of the present invention, those skilled in the art may make various changes or modifications to the present invention. Such equivalents also fall within the scope defined by the appended claims.
Claims
1. A method for eliminating pseudo contours in a quantized image, characterized in that: The following steps are involved: S1, obtaining the original image that has not been quantized and performing pre-quantization processing; S2. Locate the pseudo contour candidate area in the original image based on the pre-quantized image and the judgment algorithm based on the connected set feature; S3, mapping the pseudo contour candidate area of the original image that has not been quantized before formal quantization. Specifically, S3 includes: S31, dividing the pixel region subsets in the pseudo contour candidate region into color levels, and dividing each pixel region subset T in the pseudo contour candidate region contained in the original image into color levels before formally quantizing the image. i The pixel values involved in each are divided into the color level set E in order from small to large i ={E i(1) , E i(2) , …E i(o) }, where i is the sequence label of the pixel subset, o is the total number of pixel values involved in the pixel region subset, and each pixel value is a color level. The pixel region subset T is calculated by the following formula: i The initial quantized value q i , Among them, ceil is the logarithm rounded up, d i For the color level set E i The median of the elements, n is the quantization of n bits, and n-bit quantization means setting the lowest n bits of the x-bit binary pixel value of each pixel of the x-bit grayscale image to zero; Set each color level E i The elements in are divided into n subgroups according to the size of each spa element as a subgroup, forming a subgroup set R={R1, R2,…R n }, where spa is calculated as follows: S32, calculate the mapping target value of each color level pixel, for all color level sets E i , compare the color levels contained in each color level subgroup in the pixel area subset T i The number of pixels corresponding to the minimum value is recorded as r min ; Set a mapping target value array H={H1, H2,…H n }, where H i R i The color levels contained in T i The target mapping value of the corresponding pixel is calculated as follows: ; Where n is the number of subgroups; S33, mapping the pixels in the pseudo contour candidate area. Specifically, T i The pixel values of the corresponding pixels are divided into color scale subgroups to determine the corresponding primary mapping target values and perform mapping; S4, formally quantizing the mapped image for transmission or storage; S5. Extract the area to be remapped from the formally quantized image that has been called after transmission or storage, perform remapping, and complete the pseudo contour elimination process.
2. The method for eliminating pseudo contours of quantized images according to claim 1, wherein S2 include: S21, performing convolution filtering and connected set expansion processing on the pre-quantized image using an average weighted filter kernel; S22, aggregate the sub-connected sets into a mother connected set; S23, determining whether the pixel value difference between any two adjacent sub-connected sets in each mother connected set is equal to a set value, and discarding the mother connected sets for which the above determination result is no; S24, counting the number of pixels of the sub-connected sets in each mother connected set, and sorting the pixel numbers from small to large, comparing the median of the pixel numbers with the mother connected set determination threshold M, and if it is less than M, discarding the mother connected set; S25. According to the coordinate ranges of all non-discarded mother connected sets in the pre-quantized image, extract the pseudo-contour candidate area in the original image that has not been quantized; and according to the coordinate ranges of each child connected set contained in all mother connected sets in the pre-quantized image, extract a subset of pixel areas in the pseudo-contour candidate area of the original image.
3. The method for eliminating pseudo contours of a quantized image according to claim 2, wherein: The threshold M is set between 0.01% and 0.05% of the total pixel value of the image.
4. The method for eliminating pseudo contours of quantized images according to claim 2, wherein S5 include: S51, using the quantized and marked connected sets to perform seed growth, complete the determination and aggregation of connected sets, and extract the area to be remapped; S52 , calculating the secondary mapping target pixel value of each pixel in the area to be secondary mapped, and completing the secondary mapping to eliminate the pseudo contour problem of the image.
5. A terminal device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method for eliminating false contours in a quantized image according to any one of claims 1 to 4.
6. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the method for eliminating false contours of a quantized image according to any one of claims 1 to 4 are implemented.
7. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the method for eliminating false contours of a quantized image according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Adaptive false contouring prevention in layered coding of images with extended dynamic range
CN103918274A
Image display processing method, storage medium and terminal equipment
CN113965790A