CN109389558B - Method and device for eliminating image edge saw teeth - Google Patents

Method and device for eliminating image edge saw teeth Download PDF

Info

Publication number
CN109389558B
CN109389558B CN201710658955.XA CN201710658955A CN109389558B CN 109389558 B CN109389558 B CN 109389558B CN 201710658955 A CN201710658955 A CN 201710658955A CN 109389558 B CN109389558 B CN 109389558B
Authority
CN
China
Prior art keywords
image
processed
edge
pixel value
pixel values
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710658955.XA
Other languages
Chinese (zh)
Other versions
CN109389558A (en
Inventor
张舜
何东健
柯华强
张志德
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Automobile Group Co Ltd
Original Assignee
Guangzhou Automobile Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Automobile Group Co Ltd filed Critical Guangzhou Automobile Group Co Ltd
Priority to CN201710658955.XA priority Critical patent/CN109389558B/en
Publication of CN109389558A publication Critical patent/CN109389558A/en
Application granted granted Critical
Publication of CN109389558B publication Critical patent/CN109389558B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration by the use of more than one image, e.g. averaging, subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination

Abstract

The invention discloses a method for eliminating image edge saw teeth, which comprises the following steps: firstly, analyzing pixel values of a foreground image and a background image of an image to be processed; then determining an edge to be processed of the foreground image, acquiring a pixel value of the edge to be processed, acquiring a mixed pixel value according to the pixel value of the edge to be processed and the pixel value of the background image, and changing the transparency of the mixed pixel into opacity; then replacing the original pixel values of the corresponding positions in the image edges with the mixed pixel values to generate a processed foreground image; and finally, synthesizing the processed foreground image and the background image to generate a new image. The invention also discloses a device for eliminating the image edge saw teeth. The method and the device can display images with rich colors under the conditions of poor display performance and poor processor performance, achieve the optimization effect of eliminating the saw teeth at the edges of the icons, and can greatly reduce the cost required by a display interface.

Description

Method and device for eliminating image edge saw teeth
Technical Field
The invention relates to the field of image processing, in particular to a method and a device for eliminating image edge sawteeth.
Background
Today, conventional methods of eliminating image edge aliasing require efficient processor performance. At present, many pictures are in high-quality picture formats with rich colors, and when the pictures are displayed on a hardware platform with lower processor performance and poorer display performance, the displayed pictures have color loss, particularly obvious color loss at the edges of the pictures, jaggy generation and poor visual effect. Under the hardware condition, a high-quality picture needs to be converted into a low-quality picture and then input into a display for display, the operation is complex, and the picture quality needs to be reduced gradually according to the performance requirement of the display.
Disclosure of Invention
In order to solve the above current situation in the prior art, the present invention provides a method for eliminating image edge jaggies, which can be conveniently used on a hardware platform with low processing performance and poor display performance.
In order to achieve the above object, the present invention provides a method for removing edge aliasing of an image, the method comprising the steps of: step 110: analyzing pixel values of a foreground image and a background image of an image to be processed; step 120: determining an edge to be processed of the foreground image, acquiring a pixel value of the edge to be processed, acquiring a mixed pixel value according to the pixel value of the edge to be processed and the pixel value of the background image, and changing the transparency of the mixed pixel into opacity; step 130: replacing the original pixel values of the corresponding positions in the image edges with the mixed pixel values to generate a processed foreground image; step 140: and synthesizing the processed foreground image and the background image to generate a new image.
Further, the step of determining the to-be-processed edge of the foreground image comprises: and selecting the areas of the semi-transparent pixels and the full-transparent pixels in the edges of the foreground image to be processed as the edges of the foreground image to be processed according to the analyzed pixel values of the foreground image to be processed.
Further, the mixed pixel value is calculated according to the following formula: r (c) (1-alpha) × r (b) + alpha r (a); g (c) ((1-alpha) × g (b) + alpha × g (a)); b (c) ((1-alpha) × b (b) + alpha × b (a)); wherein C represents the processed image, A represents the background area of the image, B represents the foreground area of the image, and alpha is a transparency value of 0-1.
Further, at said step 110: after analyzing the pixel values of the foreground image and the background image of the image to be processed, the method further comprises the following steps: and establishing an ordered array, and storing the analyzed pixel values into the ordered array according to positions.
Further, the ordered array is a two-dimensional matrix which is established according to the image to be processed and comprises the width and the height of the image to be processed.
Further, the step 130: replacing the original pixel values at the corresponding positions in the image edges with the mixed pixel values to generate a processed foreground image specifically includes: step 131: clearing the original pixel values of the edge to be processed in the ordered array; step 132: and storing the mixed pixel values into the positions of the removed original pixel values in the ordered array in a one-to-one correspondence manner.
Preferably, step 130: replacing the original pixel values of the corresponding positions in the edge to be processed with the mixed pixel values to generate a processed foreground image, further comprising: step 133: and filling one or more pixel values of the background image at corresponding positions in the outward direction of the edge after the foreground image processing, and storing the newly filled pixel values into a new position in the ordered array.
Further, the step 140: synthesizing the processed foreground image and the background image to generate a new image specifically includes: step 141: extracting pixel values of the processed foreground image and pixel values of the processed background image from the ordered array; step 142: sequentially combining the extracted pixel values of the processed foreground image and the extracted pixel values of the background image to form a new image; step 143: and outputting the new image to a display interface.
The invention also provides a device for eliminating the image edge sawtooth, which comprises an analysis module, a data processing module, a value assignment module and a synthesis module. The analysis module is used for analyzing the pixel values of a foreground image and a background image of the image to be processed; the data processing module is used for determining a to-be-processed edge of the foreground image, calculating a mixed pixel value after acquiring a pixel value of the to-be-processed edge, and changing the transparency of the mixed pixel value into non-transparency; the to-be-processed edge of the foreground image is an area of a semi-transparent pixel and a full-transparent pixel in the edge of the foreground image to be processed, which is selected by the data processing module according to the analyzed pixel value of the foreground image to be processed; the assignment module is used for replacing the original pixel value of the corresponding position in the edge to be processed with the mixed pixel value to generate a processed foreground image; the synthesis module is used for synthesizing the processed foreground image and the background image to generate a new image.
The invention also provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method as described above.
The invention has the advantages that the invention can display high-quality pictures with rich colors by applying a simple algorithm on a hardware platform with lower processor performance and poorer display performance, eliminates the saw-tooth shape of the image edge and achieves good display effect.
Drawings
The invention is further illustrated with reference to the following figures and examples.
Fig. 1 is a flowchart illustrating a method for eliminating image edge aliasing according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a two-dimensional coordinate system established according to an image according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of an image area for generating jaggies according to an embodiment of the present invention.
Fig. 4 is a schematic flowchart of step 130 shown in fig. 1 according to an embodiment of the present invention.
Fig. 5 is a schematic flowchart of step 140 shown in fig. 1 according to an embodiment of the present invention.
Fig. 6 is a schematic structural diagram of an apparatus for eliminating image edge aliasing according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
As shown in fig. 1, the present invention provides a method for eliminating edge aliasing of an image, comprising the following steps:
step 110: analyzing pixel values of a foreground image and a background image of an image to be processed;
step 120: determining an edge to be processed of the foreground image, acquiring a pixel value of the edge to be processed, acquiring a mixed pixel value according to the pixel value of the edge to be processed and the pixel value of the background image, and changing the transparency of the mixed pixel into opacity;
step 130: replacing the original pixel value of the corresponding position in the edge to be processed with the mixed pixel value to generate a processed foreground image;
step 140: and synthesizing the processed foreground image and the background image to generate a new image.
On a general-purpose hardware platform, when a high-quality and rich-color picture is input to a hardware platform with poor display performance and poor processor performance, color loss often occurs. The method can be applied to the current mainstream general hardware platform, and can achieve the effect of eliminating edge saw teeth when displaying the photos of the pictures with high quality and rich colors. In addition, the transparency of the mixed pixels is changed into the opacity by the method, so that the obtained mixed pixels can be better displayed subsequently, and the problem that the background image and the foreground image are overlapped or the color is lost is avoided.
As shown in fig. 2, an ordered array of a two-dimensional matrix including the width and height of the image is created from the image, and the resolved pixel values are stored into the ordered array by location. Specifically, a two-dimensional coordinate system can be freely established on a two-dimensional space of the image, the coordinate position (x, y) of each pixel unit of the image is arranged, and the analyzed pixel value is assigned to the coordinate position (x, y) of each pixel unit. Therefore, the pixel values to be processed can be conveniently found from the ordered pixel array according to the corresponding positions, and the pixel value loss can be avoided.
As shown in fig. 3, in the present embodiment, the jagged image areas that need to be processed are the semi-transmissive pixel area 20 and the fully-transmissive pixel area 30 in the edge to be processed. When high quality pictures are imported onto mainstream hardware platforms with low processing performance, color loss occurs at the edges of the displayed picture. The transparency of the image area with color loss is full transparency or semi-transparency, the color loss of the full-transparency pixel area can be visually seen on the display screen, and the semi-transparency pixel area is overlapped with the background image. In the fully transparent pixel region, the pixels of the foreground image in the region are lost; in the translucent area, the pixels of the foreground image and the pixels of the background image in the area are overlaid. Therefore, according to the analyzed pixel value of the foreground image to be processed, the area of the semi-transparent pixel and the full-transparent pixel in the edge of the foreground image to be processed is selected as the edge to be processed of the foreground image to be processed, the pixel value of the area is calculated by a computer to obtain a mixed pixel value, the mixed pixel value is stored in a cache, the image position with lost or overlapped colors is replaced, and the effect of eliminating edge sawteeth can be achieved efficiently.
Further, in this embodiment, the pixel value may be an RGB three-channel value, and the computer may calculate the mixed pixel value according to the following formula:
R(C)=(1-alpha)*R(B)+alpha*R(A)
G(C)=(1-alpha)*G(B)+alpha*G(A)
B(C)=(1-alpha)*B(B)+alpha*B(A)
wherein C represents the processed image, A represents the background area of the image, B represents the foreground area of the image, and alpha is a transparency value of 0-1. The transparency is represented by alpha, and the transparency value is 1 when the transparency of the image pixel unit is fully transparent and 0 when the transparency of the image pixel unit is opaque. In addition, when the pixel units of the foreground image and the background image are overlapped, the image is in a semitransparent state, and the transparency value is between 0 and 1.
In this embodiment, as shown in fig. 4, the step 130: replacing the original pixel values of the corresponding positions in the image edge with the mixed pixel values to generate a processed foreground image may include, but is not limited to:
step 131: clearing the original pixel values of the edge to be processed in the ordered array;
step 132: and storing the mixed pixel values into the positions of the removed original pixel values in the ordered array in a one-to-one correspondence manner.
In this implementation, after the mixed pixel values are stored in the corresponding original positions in the ordered array, there are some color impurities along the outer edge of the image. To enable image edges to be fused with the background image, in one embodiment, step 130 further comprises:
step 133: and filling one or more pixel values of the background image at corresponding positions in the outward direction of the processed edge of the foreground image, and storing the newly filled pixel values into a new position in the ordered array.
Specifically, as shown by the arrow in fig. 3, the outward-edge region of the image is a region located on the processed foreground image and away from the edge of the foreground image.
In this embodiment, as shown in fig. 5, the step 140: synthesizing the processed foreground image with the background image to generate a new image may include, but is not limited to:
step 141: extracting pixel values of the processed foreground image and pixel values of the processed background image from the ordered array;
step 142: sequentially combining the extracted pixel values of the processed foreground image and the extracted pixel values of the background image to form a new image;
step 143: and outputting the new image to a display interface.
It should be noted that, for the device with stronger image processing capability, the device can extract the pixels of the image to be processed, and the pixels are stored in the ordered array after the processing is completed through the above steps, and it is not limited to that each step needs to store the pixels into the ordered array first, then extract the pixels from the ordered array and process the pixels, and finally store the processed pixels into the ordered array.
As shown in fig. 6, an apparatus for eliminating edge aliasing of an image includes a parsing module 601, a data processing module 602, an assigning module 603, and a synthesizing module 604.
The analysis module 601 is configured to analyze pixel values of a foreground image and a background image of an image to be processed; the data processing module 602 is configured to determine a to-be-processed edge of the foreground image, calculate a mixed pixel value after obtaining a pixel value of the to-be-processed edge, and change a transparency of the mixed pixel value into an opaque one. The assigning module 603 is configured to replace the original pixel value at the corresponding position in the edge to be processed with the mixed pixel value to generate a processed foreground image. The synthesis module 604 is configured to synthesize the processed foreground image and the background image to generate a new image.
Specifically, the data processing module 602 selects, according to the analyzed pixel value of the foreground image to be processed, a region of a semi-transparent pixel and a fully-transparent pixel in an edge of the foreground image to be processed as the edge of the foreground image to be processed.
The invention also provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method as described above.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature.
Although embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and not to be construed as limiting the present invention, and that changes, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (9)

1. A method for removing edge aliasing from an image, comprising the steps of:
step 110: analyzing pixel values of a foreground image and a background image of an image to be processed;
step 120: according to the analyzed pixel value of the foreground image, selecting a region of a semi-transparent pixel and a full-transparent pixel in the edge of the foreground image as a to-be-processed edge of the foreground image, acquiring the pixel value of the to-be-processed edge, acquiring a mixed pixel value according to the pixel value of the to-be-processed edge and the pixel value of the background image, and changing the transparency of the mixed pixel value into opacity;
step 130: replacing the original pixel value of the corresponding position in the edge to be processed with the mixed pixel value to generate a processed foreground image;
step 140: and synthesizing the processed foreground image and the background image to generate a new image.
2. The method of claim 1, wherein the blended pixel value is calculated according to the following formula:
R(C)=(1-alpha)*R(B)+alpha*R(A);
G(C)=(1-alpha)*G(B)+alpha*G(A);
B(C)=(1-alpha)*B(B)+alpha*B(A);
wherein C represents the processed image, A represents the background area of the image, B represents the foreground area of the image, and alpha is a transparency value of 0-1.
3. The method for eliminating image edge aliasing according to claim 1, wherein in step 110: after analyzing the pixel values of the foreground image and the background image of the image to be processed, the method further comprises the following steps:
and establishing an ordered array, and storing the analyzed pixel values into the ordered array according to positions.
4. The method for eliminating image edge aliasing according to claim 3, wherein the ordered array is a two-dimensional matrix established according to the image to be processed and comprising the width and the height of the image to be processed.
5. The method for eliminating image edge aliasing according to claim 4, wherein the step 130: replacing the original pixel value of the corresponding position in the edge to be processed with the mixed pixel value to generate a processed foreground image, including:
step 131: clearing the original pixel values of the edge to be processed in the ordered array;
step 132: and storing the mixed pixel values into the positions of the removed original pixel values in the ordered array in a one-to-one correspondence manner.
6. The method for eliminating image edge aliasing according to claim 5, wherein the step 130: replacing the original pixel values of the corresponding positions in the edge to be processed with the mixed pixel values to generate a processed foreground image, further comprising:
step 133: and filling one or more pixel values of the background image at corresponding positions in the outward direction of the processed edge of the foreground image, and storing the newly filled pixel values into a new position in the ordered array.
7. The method of claim 6, wherein the step 140: synthesizing the processed foreground image and the background image to generate a new image specifically includes:
step 141: extracting pixel values of the processed foreground image and pixel values of the processed background image from the ordered array;
step 142: sequentially combining the extracted pixel values of the processed foreground image and the extracted pixel values of the background image to form a new image;
step 143: and outputting the new image to a display interface.
8. An apparatus for edge aliasing cancellation in an image, comprising:
the analysis module is used for analyzing the pixel values of the foreground image and the background image of the image to be processed;
the data processing module is used for determining a to-be-processed edge of the foreground image, acquiring a mixed pixel value according to a pixel value of the to-be-processed edge and a pixel value of the background image, and changing the transparency of the mixed pixel value into opacity; the to-be-processed edge of the foreground image is an area of a semi-transparent pixel and a full-transparent pixel in the edge of the foreground image, which is selected by the data processing module according to the analyzed pixel value of the foreground image;
the assigning module is used for replacing the original pixel value of the corresponding position in the edge to be processed with the mixed pixel value so as to generate a processed foreground image;
and the synthesis module is used for synthesizing the processed foreground image and the background image to generate a new image.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN201710658955.XA 2017-08-03 2017-08-03 Method and device for eliminating image edge saw teeth Active CN109389558B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710658955.XA CN109389558B (en) 2017-08-03 2017-08-03 Method and device for eliminating image edge saw teeth

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710658955.XA CN109389558B (en) 2017-08-03 2017-08-03 Method and device for eliminating image edge saw teeth

Publications (2)

Publication Number Publication Date
CN109389558A CN109389558A (en) 2019-02-26
CN109389558B true CN109389558B (en) 2020-12-08

Family

ID=65413311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710658955.XA Active CN109389558B (en) 2017-08-03 2017-08-03 Method and device for eliminating image edge saw teeth

Country Status (1)

Country Link
CN (1) CN109389558B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111739084B (en) * 2019-03-25 2023-12-05 上海幻电信息科技有限公司 Picture processing method, atlas processing method, computer device, and storage medium
CN110427944A (en) * 2019-09-06 2019-11-08 重庆紫光华山智安科技有限公司 Acquisition methods, device, equipment and the storage medium of car plate detection data
CN112785511A (en) * 2020-06-30 2021-05-11 青岛经济技术开发区海尔热水器有限公司 Image anti-aliasing processing method and electrical equipment
CN112070873B (en) * 2020-08-26 2021-08-20 完美世界(北京)软件科技发展有限公司 Model rendering method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150206299A1 (en) * 2012-09-24 2015-07-23 Barco N.V. Method and system for validating image data
CN106170084A (en) * 2015-05-21 2016-11-30 三星电子株式会社 Multi-view image display device and control method thereof and multi-view image production method
CN106937103A (en) * 2015-12-31 2017-07-07 深圳超多维光电子有限公司 A kind of image processing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106600544A (en) * 2016-11-10 2017-04-26 北京暴风魔镜科技有限公司 Anti-aliasing method and anti-aliasing system based on texture mapping

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150206299A1 (en) * 2012-09-24 2015-07-23 Barco N.V. Method and system for validating image data
CN106170084A (en) * 2015-05-21 2016-11-30 三星电子株式会社 Multi-view image display device and control method thereof and multi-view image production method
CN106937103A (en) * 2015-12-31 2017-07-07 深圳超多维光电子有限公司 A kind of image processing method and device

Also Published As

Publication number Publication date
CN109389558A (en) 2019-02-26

Similar Documents

Publication Publication Date Title
CN109389558B (en) Method and device for eliminating image edge saw teeth
US9674425B2 (en) Image acquisition method and apparatus
KR20160064953A (en) Image processing device, image processing method and program
US8830402B2 (en) Image processing circuit and method thereof
JP6039657B2 (en) Method and device for retargeting 3D content
JP5858188B1 (en) Image processing apparatus, image processing method, image processing system, and program
JP2008067110A (en) Generation device for superresolution image
JP2014522596A5 (en)
TWI400694B (en) Character display apparatus
JP2002298154A (en) Image processing program, computer readable recording medium with image processing program recorded thereon, program execution device, image processor and image processing method
JP4370438B2 (en) Vector image drawing apparatus, vector image drawing method and program
CN111787240B (en) Video generation method, apparatus and computer readable storage medium
CN111260654B (en) Video image processing method and video processor
JP2010055410A (en) Image processing device, image processing method, and image processing program
CN106909283B (en) Canvas display control method and system
US9613427B2 (en) Information processing method and electronic device
JPWO2018087856A1 (en) Video composition apparatus and video composition method
JP6056511B2 (en) Image processing apparatus, method, program, and imaging apparatus
JP2012108825A (en) Information processing device, information processing method and program
JP6344651B2 (en) Imaging device with focus assist function
CN110597578B (en) Continuous OSD storage display method and device
JP2017117206A (en) Photographing device and photographing method
JP5672168B2 (en) Image processing apparatus, image processing method, and program
CN107993213B (en) De-sawtooth image scaler and de-sawtooth method thereof
TWI453695B (en) Video processing method and circuit using thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant