Image compression method and device applied to OSD image and medium

By dividing the OSD image into color areas and performing main color statistics, combining the color difference distance formula and RLE encoding, the problem of edge different colors during OSD image compression is solved, and the continuity and efficient compression of the image edges are achieved.

CN119967183APending Publication Date: 2025-05-09SHANGHAI INTEGRATED CIRCUIT RESEARCH & DEVELOPMENT CENTER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311485950.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-08
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

When the existing image compression algorithm processes OSD images, it will cause discontinuous strange colors to appear at the edges of the image, causing pollution, and cannot effectively solve the problem of different colors at the edges of the OSD images due to image compression.

Method used

By dividing the OSD image into M color areas, counting the main color of each color area, dividing it into edge areas and main areas, converting the main area into preset colors based on the color difference distance formula, and color transition weakening is performed in the edge areas, and finally using the RLE encoding mechanism for compression.

Benefits of technology

It effectively improves the problem of image edge heterochromatic caused by image compression in OSD images. Through partitioning processing and color transition weakening, the continuity and natural transition of image edges are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119967183A_ABST
    Figure CN119967183A_ABST
Patent Text Reader

Abstract

The invention provides an image compression method and device applied to OSD image data and a medium. The method comprises the steps that the OSD image data is divided into M color areas; counting the main color of each color area, and dividing each color area into an edge area and a main body area according to a main color counting result; converting the main body area of the M color areas into N preset colors based on the chromatic aberration distance, and performing color transition weakening processing on the edge area of the M color areas based on the main color close to the edge area; and carrying out classification compression on the color-changed image data by using an RLE coding mechanism. According to the method, the problem of image edge color difference of OSD image data due to image compression can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image compression method, device and medium applied to OSD images. Background Art

[0002] The on-screen display (OSD) adjustment method adjusts various parameters through the function menu displayed on the screen. The image data of the OSD is stored in the storage device, and the OSD operations that can be performed are often closely related to the data itself and the size of the storage device.

[0003] Existing image compression algorithms usually use run-length encoding for data compression. Run-length encoding, also known as run-length encoding, is a simple non-destructive data compression method. The key process of using run-length encoding for data compression algorithms is to perform color conversion on the image and convert the color into N single colors. However, when the above data compression algorithm is applied to the compression of OSD image data, because the edges of OSD image data are often anti-aliased, if the color conversion operation is performed, discontinuous different colors will appear on the edges of the image, causing pollution. Therefore, it is urgent to provide an image compression algorithm applied to OSD to improve the above problems. Summary of the invention

[0004] The object of the present invention is to provide an image compression method, device and medium applied to OSD images, so as to improve the problem of different color at the edge of the OSD images caused by image compression.

[0005] To achieve the above-mentioned purpose, the present invention provides an image compression method applied to OSD, comprising: dividing the OSD image into M color areas; counting the main color of each color area, and dividing each color area into an edge area and a main area according to the main color statistical result; converting the main area of ​​the M color areas into N preset colors based on the color difference distance, and performing color transition weakening processing on the edge areas of the M color areas based on the main colors adjacent to the edge areas; using the RLE encoding mechanism to classify and compress the image data after color conversion.

[0006] In a possible implementation, the OSD image is divided into M color regions, including:

[0007] The OSD image is converted into a black-and-white binary image; a connected domain analysis is performed on the black-and-white binary image, and the OSD image is divided into M color regions based on the connected domain analysis result.

[0008] In another possible implementation, the main color of each color area is counted, and each color area is divided into an edge area and a main area according to the main color statistical results, including: calculating the sum of the RGB values ​​of the pixels in each color area or the distribution probability of the RGB values; determining the main color of each color area based on the sum of the RGB values ​​or the distribution probability of the RGB values; marking the pixel distribution area corresponding to the main color as the main area of ​​the color area, and marking the remaining area of ​​the color area as the edge area of ​​the color area.

[0009] In another possible implementation, the M colors of the main area are converted into N preset colors based on the color difference distance formula, including:

[0010] For any one of the M colors in the main area, the distance between the color and N preset colors is calculated based on the color difference distance formula, and the matching rate between the color and the N preset colors is determined according to the distance between the color and the N preset colors, and the color of the main area is converted into the preset color corresponding to the maximum matching rate.

[0011] In other possible implementations, color transition weakening processing is performed on the color of the edge area based on the main color adjacent to the edge area, including: dividing the main color adjacent to the edge area into n types of sub-colors, and performing color transition weakening processing on the color of the edge area based on the n types of sub-colors.

[0012] In a second aspect, the present invention provides an image compression device for OSD images, the device comprising modules / units for executing any possible design method of the first aspect. These modules / units can be implemented by hardware, or by executing corresponding software implementations by hardware.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement any possible design method in the first aspect.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which includes a computer program. When the computer program runs on an electronic device, the electronic device executes any possible design method in the first aspect above.

[0015] In a fifth aspect, an embodiment of the present application further provides a method comprising a computer program product, which, when executed on an electronic device, enables the electronic device to execute any possible design method in the first aspect.

[0016] The beneficial effect of the image compression method, device and medium applied to OSD provided by the present invention is that the image processing area is divided into an edge area and a main area, the main area is color mapped based on the color difference distance formula, and the edge area is transitionally weakened based on the main color of the adjacent area. Based on the above method, the problem of different colors on the edge of the OSD image caused by image compression can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic flow chart of an image compression method applied to OSD images provided by the present invention;

[0018] Figure 2 A schematic diagram of another image compression process applied to OSD images provided by the present invention;

[0019] Figure 3 A schematic structural diagram of an image compression device applied to OSD images provided by the present invention. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other in the absence of conflict. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0022] In order to solve the problems mentioned in the background technology, the present application provides an image compression method applied to OSD images. Figure 1 As shown, the method comprises the following steps:

[0023] S101, dividing the OSD image into M color areas.

[0024] In this step, the OSD image may be first converted into a black-and-white binary image, and then a connected domain analysis may be performed on the black-and-white binary image, and the OSD image may be divided into M color regions based on the connected domain analysis result.

[0025] S102, counting the main color of each color area, and dividing each color area into an edge area and a main area according to the main color counting result.

[0026] In this step, there may be multiple ways to count the main color of each color area. One possible way may be: counting the RGB values ​​of each pixel in the color area, then summing the RGB values ​​of the pixels, and determining the main color of each color area based on the maximum value of the RGB values. Alternatively, the RGB values ​​of each pixel in the color area may be counted, and then a histogram may be formed. Since the histogram can reflect the distribution probability of the RGB values, according to the statistical results of the histogram, the color with the highest probability of appearing is taken as the main color of the color area.

[0027] S103, converting the M colors of the main area into N preset colors based on a color difference distance formula, and performing color transition weakening processing on the color of the edge area based on the main color adjacent to the edge area.

[0028] In a possible embodiment, for any one of the M colors in the main area, the distance between the color and N preset colors is calculated based on the color difference distance formula, the matching rate between the color and the N preset colors is determined according to the distance between the color and the N preset colors, the color of the main area is converted into a preset color corresponding to the maximum matching rate, the main color adjacent to the edge area is divided into n types of sub-colors, and the color of the edge area is subjected to color transition weakening processing based on the n types of sub-colors.

[0029] S104, using the RLE encoding mechanism, classify and compress the image data after color conversion.

[0030] It can be seen that the image processing area is divided into an edge area and a main area. The main area is color mapped based on the color difference distance formula, while the edge area is transitionally weakened based on the main color of the adjacent area. Based on the above method, the problem of image edge heterochromaticity caused by image compression in OSD images can be effectively improved.

[0031] It should be understood that in this embodiment, the on-screen menu adjustment method (On Screen Display, OSD) is applied on the display to generate some special glyphs or graphics on the screen of the display so that the user can get some information. However, the text and video in each frame are nested, and the text embedded in the image is an important way to express the semantic content of the image. Therefore, before executing S101, the OSD file can be preprocessed to obtain each frame of the image. In the specific execution process of S101, each frame of the image can be binarized and threshold filtered, and each pixel point of the binary image can be scanned. The pixels with the same pixel value and interconnected are divided into the same group, and finally all the pixel connected components in the binary image are obtained, and the connected domain analysis results of the binary image are obtained based on all the pixel connected components.

[0032] The following is further combined Figure 2 The flowchart shown in FIG. 1 systematically illustrates the above method. Figure 2 The method comprises the following steps: firstly obtaining an OSD image, then converting the OSD image into a black-and-white binary image, then performing a connected domain analysis on the black-and-white binary image, dividing the OSD image into M color regions based on the connected domain analysis result, then counting the main color of each color region, dividing each color region into an edge region and a main region according to the main color statistical result, converting the M colors of the main region into N preset colors based on a color difference distance formula, performing color transition weakening processing on the color of the edge region based on the main color adjacent to the edge region, then using an RLE encoding mechanism to classify and compress the image data after color conversion, and finally storing the compressed image data.

[0033] As can be seen from the above discussion, this embodiment does not directly use the color difference distance formula as a reference to convert all color areas, but divides the image processing area into an edge area and a main area, and the edge area is subjected to transition weakening processing based on the main color of the adjacent area, so that the color transition of the edge area is more natural. Based on the above method, the problem of different colors on the edge of the OSD image due to image compression can be effectively improved.

[0034] In some embodiments of the present application, Figure 3 As shown, the device for implementing the above method includes: a division unit 301, which is used to divide the OSD image into M color areas; count the main color of each color area, and divide each color area into an edge area and a main area according to the main color statistics result;

[0035] The conversion unit 302 is used to convert the M colors of the main area into N preset colors based on the color difference distance formula, and perform color transition weakening processing on the color of the edge area based on the main color adjacent to the edge area;

[0036] The compression unit 303 is used to classify and compress the color-converted image data using the RLE encoding mechanism.

[0037] Above Figure 1 or Figure 2 All relevant contents of each step involved in the illustrated method embodiment can be referred to the functional description of the corresponding unit module and will not be repeated here.

[0038] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the method described in the above method embodiment is implemented.

[0039] The embodiment of the present application also provides an electronic device, including a processor and a memory, wherein the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement the method described in the above method embodiment.

[0040] The present invention also provides a computer program product, which implements the method described in the above method embodiment when executed by a computer.

[0041] Although the embodiments of the present invention are described in detail above, it is obvious to those skilled in the art that various modifications and variations can be made to these embodiments. However, it should be understood that such modifications and variations are within the scope and spirit of the present invention as described in the claims. Moreover, the present invention described herein may have other embodiments and may be implemented or realized in a variety of ways.

Claims

1. An image compression method applied to OSD images, characterized in that: include: Divide the OSD image into M color regions; Count the main color of each color area, and divide each color area into an edge area and a main area according to the main color statistical results; Based on the color difference distance formula, the M colors of the main area are converted into N preset colors, and the color transition weakening processing of the edge area is performed based on the main color adjacent to the edge area; The RLE encoding mechanism is used to classify and compress the color-converted image data.

2. The method according to claim 1, characterized in that The OSD image is divided into M color regions, including: Convert the OSD image into a black and white binary image; A connected domain analysis is performed on the black-and-white binary image, and the OSD image is divided into M color regions based on the connected domain analysis result.

3. The method according to claim 2, characterized in that Count the main color of each color area, and divide each color area into an edge area and a main area according to the main color statistics, including: Calculate the sum of RGB values ​​or the distribution probability of RGB values ​​of pixels in each color region; determine the main color of each color region based on the sum of RGB values ​​or the distribution probability of RGB values; The pixel point distribution area corresponding to the main color is marked as the main area of ​​the color area, and the remaining area of ​​the color area is marked as the edge area of ​​the color area.

4. The method according to any one of claims 1 to 3, characterized in that: Based on the color difference distance formula, the M colors of the main area are converted into N preset colors, including: For any one of the M colors in the main area, the distance between the color and N preset colors is calculated based on the color difference distance formula, and the matching rate between the color and the N preset colors is determined according to the distance between the color and the N preset colors, and the color of the main area is converted into the preset color corresponding to the maximum matching rate.

5. The method according to any one of claims 1 to 3, characterized in that: The color transition weakening process of the edge area is performed based on the main color adjacent to the edge area, including: The main colors adjacent to the edge area are divided into n types of sub-colors, and the color transition weakening processing is performed on the color of the edge area based on the n types of sub-colors.

6. An image compression device applied to OSD images, characterized in that: include: A division unit, used for dividing the OSD image into M color areas; Count the main color of each color area, and divide each color area into an edge area and a main area according to the main color statistical results; A conversion unit, used to convert the M colors of the main area into N preset colors based on a color difference distance formula, and to perform color transition weakening processing on the color of the edge area based on the main color adjacent to the edge area; The compression unit is used to classify and compress the color-converted image data using the RLE encoding mechanism.

7. The device according to claim 6, characterized in that The division unit divides the OSD image into M color areas, specifically for: Convert the OSD image into a black and white binary image; A connected domain analysis is performed on the black-and-white binary image, and the OSD image is divided into M color regions based on the connected domain analysis result.

8. The device according to claim 7, characterized in that The division unit counts the main color of each color area, and divides each color area into an edge area and a main area according to the main color statistics result, specifically for: Calculate the sum of RGB values ​​or the distribution probability of RGB values ​​of pixels in each color region; determine the main color of each color region based on the sum of RGB values ​​or the distribution probability of RGB values; The pixel point distribution area corresponding to the main color is marked as the main area of ​​the color area, and the remaining area of ​​the color area is marked as the edge area of ​​the color area.

9. The device according to any one of claims 6 to 8, characterized in that The conversion unit converts the M colors of the main area into N preset colors based on the color difference distance formula, specifically for: For any one of the M colors in the main area, the distance between the color and N preset colors is calculated based on the color difference distance formula, and the matching rate between the color and the N preset colors is determined according to the distance between the color and the N preset colors, and the color of the main area is converted into the preset color corresponding to the maximum matching rate.

10. The device according to any one of claims 6 to 8, characterized in that The conversion unit performs color transition weakening processing on the color of the edge area based on the main color adjacent to the edge area, specifically for: The main colors adjacent to the edge area are divided into n types of sub-colors, and the color transition weakening processing is performed on the color of the edge area based on the n types of sub-colors.